I have an AMD CPU with 8 cores and 2 threads per core. Linux (correctly) shows this as 16 "cpus". However, sysfs actually shows 32 "possible" cpus, with 16 of them not present and offline:

$ cat /sys/devices/system/cpu/possible

$ cat /sys/devices/system/cpu/present

$ cat /sys/devices/system/cpu/online

$ cat /sys/devices/system/cpu/offline 

To be clear, there's nothing wrong here; there are indeed 16 logical CPUs present and online. What I'm not clear on is why Linux detects an addition 16 logical CPUs that are not present but possible.

I think these are the relevant kernel docs: https://www.kernel.org/doc/html/latest/core-api/cpu_hotplug.html. But I don't see any indication of how the number of possible CPUs is chosen. (Note that it's much lower than the kernel_max number of CPUs, which is 8191 on my system.)

(A little additional background: I have some code that needs to parse these values. Doing the right thing seems straightforward, but I'd like to have a clear docstring explaining why the number of possible CPUs can exceed the number of present CPUs on an ordinary desktop computer.)

1 Answer 1


A CPU is “possible” if there's room for it in the kernel memory. The number of possible CPU is the maximum number of CPU that can be brought online, including ones that are hotplugged after boot.

The documentation of this part of sysfs is in How CPU topology info is exported via sysfs:

possible: CPUs that have been allocated resources and can be brought online if they are present. [cpu_possible_mask]

But the more detailed documentation of cpu_possible_mask is in CPU hotplug in the Kernel:

Bitmap of possible CPUs that can ever be available in the system. This is used to allocate some boot time memory for per_cpu variables that aren’t designed to grow/shrink as CPUs are made available or removed. Once set during boot time discovery phase, the map is static, i.e no bits are added or removed anytime. Trimming it accurately for your system needs upfront can save some boot time memory.

This parameter can be configured through command line options. In the likely case that your hardware doesn't support plugging in another CPU without rebooting and you don't intend to hibernate your system and make it wake up with more CPUs, you can save a small amount of kernel memory by passing possible_cpus=16 on the kernel command line. On a typical PC or server, the amount is probably too small for it to be worth the effort.

In the absence of command line options, I think you need to read the source to figure out what's going on. If the kernel is compiled without CPU hotplug support (CONFIG_HOTPLUG_CPU), it just looks how many CPU are present at boot time. If the kernel has CPU hotplug support, according to a comment for prefill_possible_map in the source code:

  • If the BIOS specified disabled CPUs in ACPI/mptables use that.
  • The user can overwrite it with possible_cpus=NUM
  • Otherwise don't reserve additional CPUs.

I haven't verified that this is what the code does.

Note that the principle of what “possible CPUs” means applies to all architectures, but the ways to determine the number of CPUs are architecture-specific. In my answer I assume x86.

  • Thanks for your response. I did read that section of the doc I linked, but it doesn't answer how the value is initially set. For example, as mentioned I have a machine that has 16 present out of 32 possible. I have a work machine that shows 32 present out of 128 possible. How is the kernel deciding those default values? Commented Sep 15, 2020 at 22:14
  • @NicholasBishop The kernel asks the BIOS, apparently. I don't know how the BIOS tends to answer. Plausibly it might answer the maximum number of CPUs that the motherboard supports, or even the maximum number of CPUs that this particular BIOS binary supports. Commented Sep 15, 2020 at 22:26
  • Thanks for the update! It'd be interesting to know more details about these values coming from the BIOS. E.g. will all X570 chipset machines report the same value, or would it vary from one motherboard to another, or from one CPU to another? But I think it is fair to call that outside the scope of this question. Commented Sep 15, 2020 at 22:44
  • 1
    Linux does not actually "asks the bios" for determining how many CPUs are available at boot time. It simply reads some memory area named DMI or SMBIOS en.wikipedia.org/wiki/System_Management_BIOS . There are a couple of known cases when kernel initial guessing is wrong. (Not that much of a problem because it is solved later in the boot process) For instance, the Intel Core 2 duo reported in the DMIzone with the ht flag (hyperthreading) making so the kernel initially believes that 4 cores are available. (One can get traces of this in the bootlog of some 4.4 with NR_CPUS=2 setting.
    – MC68020
    Commented Sep 15, 2020 at 23:05
  • @MC68020 Well, ok, it doesn't “ask the BIOS”. It reads a memory area which is part of the machine's firmware. “BIOS” is the collective name of any firmware on the motherboard a PC-class x86 system. So Linux in fact asks the BIOS. Commented Sep 15, 2020 at 23:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .