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])performance problem
- From: Linus Torvalds <torvalds at linux-foundation dot org>
- To: Samuel Thibault <samuel dot thibault at ens-lyon dot org>
- Cc: Ulrich Drepper <drepper at gmail dot com>, Roland McGrath <roland at hack dot frob dot com>, "David S. Miller" <davem at davemloft dot net>, Andreas Schwab <schwab at redhat dot com>, libc-alpha at sourceware dot org
- Date: Thu, 16 Jun 2011 11:07:54 -0700
- Subject: Re: [glibc] Fix Linux sysconf(_SC_NPROCESSORS_[CONF|ONLN])performance problem
- References: <BANLkTi=ousV=JtYzAYEnMVqqX6fnF_1z9Q@mail.gmail.com> <20110616175811.GF5583@const.bordeaux.inria.fr>
On Thu, Jun 16, 2011 at 10:58 AM, Samuel Thibault
<samuel.thibault@ens-lyon.org> 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.
But the caching is needed, because whatever the process wants, I
guarantee that it doesn't want "slow and crappy".
Linus