Date: Wed, 05 Jan 2011 12:22:50 +0100 From: Ivan Voras <ivoras@freebsd.org> To: freebsd-current@freebsd.org Subject: Re: [RFC]: unnecessary padding in various kernel structures Message-ID: <ig1kaa$tgr$1@dough.gmane.org> In-Reply-To: <20110104185930.GA62775@freebsd.org> References: <20110104185930.GA62775@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 04/01/2011 19:59, Roman Divacky wrote: > hi, > > clang (svn version) has ability to detect unnecessary padding in structures. > > I ran this on kernel build on i386 (stripped GENERIC) and amd64 (full GENERIC), > preprocessed this and posted on web. > > The lists contain the file of the definition, name of the structure, size of > the unnecessary padding and reason for the alignment. The last field is > how many times this was hit during the build of the kernel. It looks like "padding... to alignment boundary" means "because of struct {...} __aligned(CACHE_LINE_SIZE)" and such, and we cannot run away from those - maybe you should filter those results out? > The lists are sorted by the size of the padding. > > Examples (i386): > > dev/usb/controller/ohci.h:64:8: 2 times > padding size of 'struct ohci_hcca' with 120 bytes to alignment boundary > sys/pcpu.h:156:8: 58 times > padding size of 'struct pcpu' with 108 bytes to alignment boundary > sys/pcpu.h:199:2: 58 times > padding struct 'struct pcpu' with 84 bytes to align 'pc_monitorbuf' > dev/usb/controller/ehci.h:170:8: 1 times > padding size of 'struct ehci_qtd' with 58 bytes to alignment boundary > kern/sched_ule.c:206:8: 1 times > padding size of 'struct tdq' with 41 bytes to alignment boundary > > Examples(amd64): > > net/flowtable.c:179:11: 1 times > padding struct 'struct flowtable' with 124 bytes to align 'ft_udp_idle' > dev/usb/controller/ohci.h:64:8: 2 times > padding size of 'struct ohci_hcca' with 120 bytes to alignment boundary > net/flowtable.c:160:8: 1 times > padding size of 'struct flowtable' with 108 bytes to alignment boundary > vm/uma_int.h:184:8: 6 times > padding size of 'struct uma_cache' with 96 bytes to alignment boundary > vm/uma_int.h:338:19: 5 times > padding struct 'struct uma_zone' with 92 bytes to align 'uz_cpu' > net/flowtable.c:149:8: 1 times > padding size of 'struct flowtable_stats' with 64 bytes to alignment boundary
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ig1kaa$tgr$1>