Skip to contentSkip to conversation

cpumask: limit visibility of FORCE_NR_CPUS

PATCH Superseded Yury Norov 3 participants 4 messages Oct 19, 2022 Library code

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Yury Norov

author
#0 lore raw

PATCH 1/1 cpumask: limit visibility of FORCE_NR_CPUS

In current form, FORCE_NR_CPUS is visible to all users building their kernels, even not experts. It is also set in allmodconfig or allyesconfig, which is not a correct behavior.

---
 lib/Kconfig | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)
lib/Kconfig +24 -7
index 9bbf8a4b2108..1ada12f5dda6 100644
@@ -528,14 +528,31 @@ config CPUMASK_OFFSTACK
 	  them on the stack.  This is a bit more expensive, but avoids
 	  stack overflow.
 
+choice
+	prompt "Number of CPUs detection method"
+	default UNFORCE_NR_CPUS
+	depends on SMP && EXPERT
+	help
+	  Select between boot-time and compile-time detection of number
+	  of CPUs. If it's possible to provide exact number of CPUs at
+	  compile-time, kernel code may be optimized better.
+	  For general-purpose kernel, choose "boot time" option.
+
+config UNFORCE_NR_CPUS
+	bool "Set number of CPUs at boot time"
+	help
+	  Choose it if you build general-purpose kernel and want to rely
+	  on kernel to detect actual number of CPUs.
+
 config FORCE_NR_CPUS
-       bool "NR_CPUS is set to an actual number of CPUs"
-       depends on SMP
-       help
-         Say Yes if you have NR_CPUS set to an actual number of possible
-         CPUs in your system, not to a default value. This forces the core
-         code to rely on compile-time value and optimize kernel routines
-         better.
+	bool "Set number of CPUs at compile time"
+	help
+	  Choose it if NR_CPUS corresponds to an actual number of
+	  possible CPUs in your system. This forces the core code
+	  to rely on compile-time value and optimize kernel routines
+	  better.
+
+endchoice
 
 config CPU_RMAP
 	bool
Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines · Yury Norov

In current form, FORCE_NR_CPUS is visible to all users building their kernels, even not experts. It is also set in allmodconfig or allyesconfig, which is not a correct behavior.

Seems you forgot to update the commit message to explain the choise usage.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#2 lore raw
Quoted 6 lines · Andy Shevchenko
Quoted 3 lines · Yury Norov

In current form, FORCE_NR_CPUS is visible to all users building their kernels, even not experts. It is also set in allmodconfig or allyesconfig, which is not a correct behavior.

Seems you forgot to update the commit message to explain the choise usage.

OK, I'll fold-in something like this:

The 'choice' and sudo config UNFORCE_NR_CPUS are used to ensure that auto-generated configs that try to enable as much options as possible, like allmodconfig, don't enable FORCE_NR_CPUS.

Is that what you mean?

#3 lore raw

Hi Yuri,

Quoted 11 lines · Yury Norov
Quoted 6 lines · Andy Shevchenko
Quoted 3 lines · Yury Norov

In current form, FORCE_NR_CPUS is visible to all users building their kernels, even not experts. It is also set in allmodconfig or allyesconfig, which is not a correct behavior.

Seems you forgot to update the commit message to explain the choise usage.

OK, I'll fold-in something like this:

The 'choice' and sudo config UNFORCE_NR_CPUS are used to ensure that

sudo?

Quoted 4 lines

auto-generated configs that try to enable as much options as possible, like allmodconfig, don't enable FORCE_NR_CPUS.

Is that what you mean?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds