Simple #define for cache line size

Nathan Whitehorn nwhitehorn at
Sat Apr 11 11:29:14 PDT 2009

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.

More information about the freebsd-arch mailing list