Date: Tue, 14 Apr 2009 09:48:34 -0400 From: John Baldwin <jhb@freebsd.org> To: freebsd-arch@freebsd.org Cc: Max Laier <max@love2party.net>, Robert Watson <rwatson@freebsd.org> Subject: Re: Simple #define for cache line size Message-ID: <200904140948.34503.jhb@freebsd.org> In-Reply-To: <200904140105.20664.max@love2party.net> References: <alpine.BSF.2.00.0904111700241.19879@fledge.watson.org> <200904140105.20664.max@love2party.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 13 April 2009 7:05:20 pm Max Laier wrote: > On Saturday 11 April 2009 18:11:55 Robert Watson wrote: > > Dear all: > > > > We have a number of __aligned() qualifiers scattered around the kernel > > intended to space objects to improve alignment with respect to cache lines. > > This is important for a number of reasons, not least avoiding cache line > > thrashing when using arrays of foo[MAXCPU]. What I'd like to do is provide > > a single compile-time constant, CACHE_LINE_SIZE, defined in > > machine-dependent param.h, to use for spacing such objects, rather than > > hard-coding various values around. Here are some examples of existing > > spacing attempts: > > How much does __aligned(FOO) even achieve? If we allocate these structs at > runtime the alignment requirements have to be passed to the allocator as well > (eg. uma(9)'s align parameter in uma_zcreate). If my assumption is correct it > would make sense to have a global symbol that is initialized early in the boot > process instead of a compile time #define. > > In addition it seems that we need to make the define a worst case value to > assure correctness for static arrays as below. Actually, we need both the boot-time tunable that UMA has I think and a worst-case constant for static arrays. UMA already has the tunable and I think it should remain (though we may want to provide a way for the MD code to adjust its value). I think the constant is still needed for static arrays and should also be used to initialize the constant in UMA. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904140948.34503.jhb>