Simple #define for cache line size

John Baldwin jhb at freebsd.org
Mon Apr 13 08:29:04 PDT 2009


On Saturday 11 April 2009 1:28:51 pm Nathan Whitehorn wrote:
> Robert Watson wrote:
> >
> >
> > NetBSD, FYI, defines CACHE_LINE_SIZE as a global constant in param.h, 
> > but I'm going with an MD definition as I suspect people will want to 
> > do different things on different architectures (and there is 
> > variation).  I've defaulted all architectures to 64 bytes, but I 
> > suspect a number would prefer to use 32.
> For what it's worth, this is per-CPU variable on PowerPC and detected at 
> runtime. Most of the CPUs we support have 32 byte cache lines, but some 
> (e.g. the G5) use 128 bytes. I'm not sure there is a general solution in 
> this case, but that's the situation on PPC.
> -Nathan

I think UMA can handle a variable size and that should be preserved.  However, 
for the purposes of aligned() I think a constant that is the maximum size 
(such as 128 on ppc) might work best.

-- 
John Baldwin


More information about the freebsd-arch mailing list