This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [glibc] Fix Linux sysconf(_SC_NPROCESSORS_[CONF|ONLN]) performanceproblem
On 06/16/11 11:41, Linus Torvalds wrote:
> I'd be happy to discuss it once the glibc implementation isn't crap.
How about this idea for improving glibc? It tries to address
your concerns and Ulrich's too:
__get_nprocs caches the number of processors, but invalidates the cache
whenever gettimeofday reports that the cache is stale.
This would avoid the need for vDSO changes, by leveraging off
the existing vDSO functionality for gettimeofday. It would mean that
__get_nprocs might return a value that is a bit stale, but that
should be good enough for real-world apps.
"Stale" could mean "the tv_sec value doesn't match", or it could be something
fancier; I doubt whether it matters much.