I was browsing the Linux kernel code these days and I was hit by many questions about the possible number of CPUs supported by the kernel.

As I understand, the kernel, according to the arch, can handle a certain number of CPUs. This number is specified in the Kconfig file and is passed to the CONFIG_NR_CPUS option.

Here is my dmesg output:

setup_percpu: NR_CPUS:5120 nr_cpumask_bits:240 nr_cpu_ids:240 nr_node_ids:1 RCU restricting CPUs from NR_CPUS=5120 to nr_cpu_ids=240

My questions are:

  • why the NR_CPUS is this large ?

  • where does the 240 nr_cpumask_bits and nr_cpu_ids come from ?

Many thanks for your help

  • How many physical and logical cores do you actually have on the system? – Kusalananda Sep 7 '17 at 12:41

why the NR_CPUS is this large ?

Because there are real Linux systems with CPU counts on that order. I've seen actual test results for 1024 CPU machines.

I don't mean clusters of independent small systems, I mean single computers with that many CPU cores, all running a single Linux kernel.

For example, SGI currently has a system capable of scaling up to 32 CPU sockets. With today's max core count of 22 in Intel's Xeon line, that gets you to 704 cores, then double that with Hyperthreading. Between the time of this writing and the time you read this, that core limit will probably have been exceeded.

where does the 240 nr_cpumask_bits and nr_cpu_ids come from ?

Probably some limit of your actual hardware. It takes a specially-designed system to handle even two physical processors. Systems that can support many physical CPU chips require all kinds of special hardware support to make it efficient: crossbar switching fabrics, NUMA schemes, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.