> The fact is, glibc is just total crap. > > I tried to send uli a patch to just add caching. No go. I sent > *another* patch to at least make glibc use a sane interface (and the > cache if it needs to fall back on /proc/stat for some legacy reason). > We'll see what happens. FWIW a rerun with this modified LD_PRELOAD that does caching seems to have the same performance as the version that does sched_getaffinity. So you're right. Caching indeed helps and my assumption that the child would only do it once was incorrect. The only problem I see with it is that it doesn't handle CPU hotplug, but Paul's suggestion would fix that too. > Paul Eggbert suggested "caching for one second" - by just calling > "gettimtofday()" to see how old the cache is. That would work too. > Maybe we need a "standard LD_PRELOAD library to improve glibc" @) -Andi