Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Apr 2015 04:01:24 -0700 (PDT)
From:      Chris Torek <torek@elf.torek.net>
To:        adrian@freebsd.org, scott4long@yahoo.com
Cc:        dchagin@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r281451 - head/sys/vm
Message-ID:  <201504241101.t3OB1O8Z029626@elf.torek.net>
In-Reply-To: <CAJ-VmonQdnkLEhspj120bPMGO9PbVJv7vkNVVt%2B42viSNwL1Ww@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
The problem seems likely to be related to odd compiler handling of
alignment.  Consider this code bit, which extracts the essentials:

	struct x {
		int x;
	} __attribute__((__aligned__(32)));

	struct s1 {
		int a;
		struct x b[1];
	};

	struct s2 {
		int a;
		struct x b[];
	};

	extern void test2(int);
	void test(void) {
	    test2(sizeof(struct s1));
	    test2(sizeof(struct s2));
	}

Compiled, here are the two sizeof values (this particular compiler
output is from clang but gcc and clang both agree on sizeof here):

	movl	$64, %edi
	callq	test2
	movl	$32, %edi
	popq	%rbp
	jmp	test2                   # TAILCALL

With the flexible array, (sizeof(struct uma_cache)) is going to be
32 bytes smaller than without it.

(I have not looked closely enough to determine what the size should be.)

Chris



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504241101.t3OB1O8Z029626>