tech-userlevel archive

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

Re: malloc, thread and alignment



Le 26/03/2015 15:13, Emmanuel Dreyfus a écrit :
Hello

jemmaloc(3) says:
Allocations are packed tightly together, which can be an issue for multi-
  threaded applications.  If you need to assure that allocations do not
suffer from cache line sharing, round your allocation requests up to the
  nearest multiple of the cache line size.

Do we are example of how it should be done? I do not know how to discover cache line size, neither do I know how I can specify alignment based on it.

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.

--
Jean-Yves Migeon
jym@


Home | Main Index | Thread Index | Old Index