Date: Sun, 12 Apr 2009 04:25:52 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Jason Evans <jasone@FreeBSD.org> Cc: arch@FreeBSD.org, Robert Watson <rwatson@FreeBSD.org> Subject: Re: Simple #define for cache line size Message-ID: <20090412041840.F4999@besplex.bde.org> In-Reply-To: <49E0C7D3.1010005@FreeBSD.org> References: <alpine.BSF.2.00.0904111700241.19879@fledge.watson.org> <49E0C7D3.1010005@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 11 Apr 2009, Jason Evans wrote: > Robert Watson wrote: >> Index: arm/include/param.h >> =================================================================== >> --- arm/include/param.h (revision 190941) >> +++ arm/include/param.h (working copy) >> @@ -81,6 +81,10 @@ >> #define ALIGNBYTES _ALIGNBYTES >> #define ALIGN(p) _ALIGN(p) >> >> +#ifndef CACHE_LINE_SIZE >> +#define CACHE_LINE_SIZE 64 >> +#endif >> + >> #define PAGE_SHIFT 12 >> #define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */ >> #define PAGE_MASK (PAGE_SIZE - 1) >> Index: powerpc/include/param.h > > It would be helpful to instead do: > > #ifndef CACHE_LINE_SHIFT > #define CACHE_LINE_SHIFT 6 > #endif > #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) > > In particular, src/lib/libc/stdlib/malloc.c would benefit. It shouldn't be ifdefed, since it isn't an option and any override of the definition would tend to give binary incompatibilities, especially if it is used in userland (userland can't match kernel options or know if they are matched). FreeBSD already has too many non-options like this. CACHE_LINE_* is mainly advisory but would still cause binary incompatibilities when it is used for array sizes. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090412041840.F4999>