[Bug libc/28991] sysconf(_SC_NPROCESSORS_CONF) should read /sys/devices/system/cpu/possible
adhemerval.zanella at linaro dot org
sourceware-bugzilla@sourceware.org
Wed Mar 23 11:57:22 GMT 2022
https://sourceware.org/bugzilla/show_bug.cgi?id=28991
Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |adhemerval.zanella at linaro dot o
| |rg
--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
I am not sure if we can actually /sys/devices/system/cpu/possible, since for
some architecture it reports possible hotplug cpus that might not actually be
present in the system.
For instance, on my system with a Ryzen 5900x (12c, 24t) I see:
$ sudo dmesg
[...]
[ 0.065499] smpboot: Allowing 32 CPUs, 8 hotplug CPUs
[...]
$ cat /sys/devices/system/cpu/possible
0-31
$ cat /sys/devices/system/cpu/online
0-23
$ cat /sys/devices/system/cpu/offline
24-31
And thus using 'possible' will wrongly report 32 cpus on a system with the
maximum of 24.
The Linux source give us some hints why it is doing it:
arch/x86/kernel/smpboot.c
1513 * Three ways to find out the number of additional hotplug CPUs:
1514 * - If the BIOS specified disabled CPUs in ACPI/mptables use that.
1515 * - The user can overwrite it with possible_cpus=NUM
1516 * - Otherwise don't reserve additional CPUs.
1517 * We do this because additional CPUs waste a lot of memory.
So I am guessing that BIOS in my case it reporting 32 because it supports the
Ryzen 5950x, even thought he system does not actually support a large number of
cpus.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list