glibc/sysdeps
Dmitry V. Levin e1d32b8364 linux: fix accuracy of get_nprocs and get_nprocs_conf [BZ #28865]
get_nprocs() and get_nprocs_conf() use various methods to obtain an
accurate number of processors.  Re-introduce __get_nprocs_sched() as
a source of information, and fix the order in which these methods are
used to return the most accurate information.  The primary source of
information used in both functions remains unchanged.

This also changes __get_nprocs_sched() error return value from 2 to 0,
but all its users are already prepared to handle that.

Old fallback order:
  get_nprocs:
    /sys/devices/system/cpu/online -> /proc/stat -> 2
  get_nprocs_conf:
    /sys/devices/system/cpu/ -> /proc/stat -> 2

New fallback order:
  get_nprocs:
    /sys/devices/system/cpu/online -> /proc/stat -> sched_getaffinity -> 2
  get_nprocs_conf:
    /sys/devices/system/cpu/ -> /proc/stat -> sched_getaffinity -> 2

Fixes: 342298278e ("linux: Revert the use of sched_getaffinity on get_nproc")
Closes: BZ #28865
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-02-07 20:18:29 +00:00
..
aarch64 elf: Fix runtime linker auditing on aarch64 (BZ #26643) 2022-02-01 14:49:46 -03:00
alpha Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
arc Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
arm Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
csky Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
generic SET_RELHOOK: merge i386 and x86_64, and move to sysdeps/mach/hurd/x86 2022-02-01 20:08:25 +00:00
gnu Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
hppa elf: Issue la_symbind for bind-now (BZ #23734) 2022-02-01 14:49:46 -03:00
htl htl: Fix build error in annexc 2022-01-17 23:18:27 +00:00
hurd hurd: Fix pthread_kill on exiting/ted thread 2022-01-15 15:11:54 +01:00
i386 SET_RELHOOK: merge i386 and x86_64, and move to sysdeps/mach/hurd/x86 2022-02-01 20:08:25 +00:00
ia64 elf: Issue la_symbind for bind-now (BZ #23734) 2022-02-01 14:49:46 -03:00
ieee754 math: Fix float conversion regressions with gcc-12 [BZ #28713] 2022-01-10 14:27:17 +00:00
m68k Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
mach posix: Replace posix_spawnattr_tc{get,set}pgrp_np with posix_spawn_file_actions_addtcsetpgrp_np 2022-02-02 08:34:16 -03:00
microblaze Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
mips elf: Add <dl-r_debug.h> 2022-01-31 07:05:48 -08:00
nios2 Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
nptl Linux: Use ptrdiff_t for __rseq_offset 2022-02-02 22:37:20 +01:00
or1k or1k: Define PI_STATIC_AND_HIDDEN 2022-02-02 20:05:12 +09:00
posix getcwd: Set errno to ERANGE for size == 1 (CVE-2021-3999) 2022-01-24 11:00:17 +05:30
powerpc elf: Issue la_symbind for bind-now (BZ #23734) 2022-02-01 14:49:46 -03:00
pthread Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
riscv Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
s390 s390x: Use <gcc-macros.h> in early HWCAP check 2022-01-14 20:17:58 +01:00
sh Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
sparc Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
unix linux: fix accuracy of get_nprocs and get_nprocs_conf [BZ #28865] 2022-02-07 20:18:29 +00:00
wordsize-32 Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
wordsize-64 Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
x86 x86: Improve L to support L(XXX_SYMBOL (YYY, ZZZ)) 2022-02-05 16:42:17 -08:00
x86_64 x86: Remove SSSE3 instruction for broadcast in memset.S (SSE2 Only) 2022-02-07 14:18:29 -06:00