Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 877615

Summary: sys-kernel/gentoo-kernel-5.19.16: /sys/devices/system/cpu/possible lists non-existing processors (or nproc/glibc uses it wrong)
Product: Gentoo Linux Reporter: Michał Górny <mgorny>
Component: Current packagesAssignee: Distribution Kernel Project <dist-kernel>
Status: CONFIRMED ---    
Severity: normal CC: base-system
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-10-19 03:46:02 UTC
$ uname -r
5.19.16-gentoo-dist
$ cat /sys/devices/system/cpu/possible 
0-31
$ cat /sys/devices/system/cpu/present 
0-11
$ cat /sys/devices/system/cpu/online 
0-11
$ cat /sys/devices/system/cpu/offline 
12-31


This seems to cause `nproc --all` to think I have 32 logical CPUs installed, even though 12 is the correct number.  I haven't verified it here but according to others, "offline" is empty on their systems with <=5.15 kernels.
Comment 1 Greg Kubaryk 2022-10-19 04:04:13 UTC
It was requested that I provide this data point here that offline may not be relevant as originally thought. (Yes, I know the box needs a reboot.)

$ uname -r
5.19.14
$ nproc
8
$ nproc --all
8
$ cat /sys/devices/system/cpu/possible 
0-7
$ cat /sys/devices/system/cpu/present
0-7
$ cat /sys/devices/system/cpu/online
0-7
$ cat /sys/devices/system/cpu/offline 
,8-15
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-10-19 04:05:57 UTC
Ok, the problem seems to be actually in "possible" as that is what nproc seems to read through glibc.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-24 20:30:39 UTC
Was this in a container? juippis and I discussed a problem like this before in Docker in the context of Portage trying to figure out the # of active CPUs for load average.