tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: malloc, thread and alignment

   Date: Fri, 27 Mar 2015 16:30:32 +0100
   From: "Jean-Yves Migeon (NetBSD)" <>

   For x86 you can look at cpuctl(8), identifycpu() uses cpuid to get this 
   information. This is MD and varies between AMD/Intel, revisions... This 
   requires not-so-funny tests to deduce the correct value. I don't think 
   this is exposed through headers/libs for external use though.

   AFAICT !x86 platforms have nothing.

Perhaps we ought to expose it via a sysctl.

Someone^TM should document the kernel CACHE_LINE_SIZE, coherency_unit,
COHERENCY_UNIT, and figure out what it is worthwhile to expose MI to
userland.  Obviously some systems may have different instruction and
data cache line sizes, and maybe there are more exotic possibilities,
but presumably there is a good conservative estimate for user programs
to round buffers to.  jemalloc seems to use 64 bytes unconditionally.

Home | Main Index | Thread Index | Old Index