This is the mail archive of the
mailing list for the glibc project.
Re: [glibc] Fix Linux sysconf(_SC_NPROCESSORS_[CONF|ONLN]) performance problem
Linus Torvalds, le Thu 16 Jun 2011 11:07:54 -0700, a écrit :
> On Thu, Jun 16, 2011 at 10:58 AM, Samuel Thibault
> <email@example.com> wrote:
> > Linus Torvalds, le Thu 16 Jun 2011 09:38:55 -0700, a écrit :
> >> ?- cache the value in a static variable, so that if/when there are
> >> multiple calls, we don't spend time recalculating the number of CPU's
> >> in the system unnecessarily.
> > Mmm, but what if the process starts with only one allowed CPU, and
> > then is given more CPUs? (either by making CPUs online, or by using
> > sched_setaffinity from an administration tool).
> So remove the use of sched_getaffinity() if you want to.
That does not change my issue: if caching is added, libdb will get a
stale value, and thus not fix its behavior according to the number of
> But the caching is needed, because whatever the process wants, I
> guarantee that it doesn't want "slow and crappy".
But it wants the current value. Else it'd do the caching itself.