glibc/sysdeps/unix
Adhemerval Zanella 822662cf2a linux: Revert the use of sched_getaffinity on get_nproc (BZ #28310)
The use of sched_getaffinity on get_nproc and
sysconf (_SC_NPROCESSORS_ONLN) done in 903bc7dcc2 (BZ #27645)
breaks the top command in common hypervisor configurations and also
other monitoring tools.

The main issue using sched_getaffinity changed the symbols semantic
from system-wide scope of online CPUs to per-process one (which can
be changed with kernel cpusets or book parameters in VM).

This patch reverts mostly of the 903bc7dcc2, with the
exceptions:

  * No more cached values and atomic updates, since they are inherent
    racy.

  * No /proc/cpuinfo fallback, since /proc/stat is already used and
    it would require to revert more arch-specific code.

  * The alloca is replace with a static buffer of 1024 bytes.

So the implementation first consult the sysfs, and fallbacks to procfs.

Checked on x86_64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 342298278e)
2021-10-01 18:19:45 +02:00
..
alpha
arm
bsd login: Hidden prototypes for _getpt, __ptsname_r, grantpt, unlockpt 2021-06-30 07:28:12 +02:00
i386
inet
mips
powerpc
sh
sysv/linux linux: Revert the use of sched_getaffinity on get_nproc (BZ #28310) 2021-10-01 18:19:45 +02:00
x86_64
confstr.h
get_child_max.c
getlogin_r.c
getlogin.c
getpagesize.c
grantpt.c login: Hidden prototypes for _getpt, __ptsname_r, grantpt, unlockpt 2021-06-30 07:28:12 +02:00
ifreq.c
Implies
make-syscalls.sh
Makefile
s-proto-cancel.S
s-proto.S
setxid.h
sockatmark.c
syscall-template.S
syscall.S
syscalls.list misc: Add time64 alias for ioctl 2021-07-21 11:58:09 +02:00
sysdep.h Linux: Explicitly disable cancellation checking in the dynamic loader 2021-05-10 10:31:41 +02:00