Get the latest tech news

Linus Torvalds Demotes "FORCE_NR_CPUS" Embedded Linux Option To Avoid Confusion


The Linux kernel 'FORCE_NR_CPUS' Kconfig option has been around a few years to force the number of CPU cores the kernel expects in order to allow for better compiler optimizations

Which led Linus Torvalds to reflect: Yeah, that warning very much means "you aren't running a valid config". It improves bitmask op code generation a tiny bit (quite a lot actually on a micro level, but not necessarily hugely noticeable in the big picture) by making nr_cpu_ids a compile-time constant, but it's such a special-case embedded-only (or "tuned for my particular machine") option that it's just not worth it. In turn Torvalds then pushed this commit to further restrict FORCE_NR_CPUS: Hardcoding the number of CPUs at compile time does improve code generation, but if you get it wrong the result will be confusion.

Get the Android app

Or read this on Phoronix

Read more on:

Photo of confusion

confusion

Photo of Linus Torvalds

Linus Torvalds

Photo of force_nr_cpus

force_nr_cpus

Related news:

News photo

Confusion Is a Muse

News photo

Linus Torvalds Throws Down The Hammer: Extensible Scheduler "sched_ext" In Linux 6.11

News photo

There's confusion over what's happening with Dragon Age Dreadwolf this week