[glibc] Fix Linux sysconf(_SC_NPROCESSORS_[CONF|ONLN]) performance problem

Linus Torvalds torvalds@linux-foundation.org
Fri Jun 17 00:55:00 GMT 2011


On Thu, Jun 16, 2011 at 1:04 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
>
> "Stale" could mean "the tv_sec value doesn't match", or it could be something
> fancier; I doubt whether it matters much.

I certainly think that would be a lot better than what glibc does now
- at least limiting the /proc/stat reading to a maximum of once per
second or similar.

And it could be combined with the patch I just sent out (which ends up
parsing /sys/devices/system/cpu/online every time. It's a cheaper (and
more obvious) file than /proc/stat, but it's still not zero-cost.

                       Linus



More information about the Libc-alpha mailing list