On Thu, 20 Jan 2011, Dennis Ferguson wrote: > On 20 Jan 2011, at 11:59 , Dennis Ferguson wrote: > > Is there a way to obtain the correct cache line size for the machine > > code is running on, both in the kernel and at user level? > > I found it. It is "coherency_unit" in the kernel (it is an > appropriately small number, rather than the cache line size, > in uniprocessor kernels), but doesn't seem to be exposed outside > of there.
What type of machine are we talking here? The powerpc ports have a system call to tell userland what the CPU's cache line size is. I needed to add it to support IBM403s (or was it 401s?) which ISTR have a 16-byte cache line. Look at the libc memcpy/memset code. Edaurdo