summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYury Norov <yury.norov@gmail.com>2022-10-19 15:59:39 -0700
committerAndrew Morton <akpm@linux-foundation.org>2022-10-24 17:21:51 -0700
commita62118fb0e3e54d114a2f44b8069e0463db9f7b7 (patch)
treeafb7de2e4d1c1174588ec0db5dfab4c2e4a58a72
parent01344551cc7cc2e7fd77d906730d523ac296c063 (diff)
downloadlinux-a62118fb0e3e54d114a2f44b8069e0463db9f7b7.tar.gz
linux-a62118fb0e3e54d114a2f44b8069e0463db9f7b7.tar.xz
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. The 'choice' and unused 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. Link: https://lkml.kernel.org/r/20221019225939.1646349-1-yury.norov@gmail.com Signed-off-by: Yury Norov <yury.norov@gmail.com> Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Alexey Klimov <klimov.linux@gmail.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Eric Biggers <ebiggers@google.com> Cc: Paul E. McKenney <paulmck@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Sander Vanheule <sander@svanheule.net> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Valentin Schneider <vschneid@redhat.com> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--lib/Kconfig31
1 files changed, 24 insertions, 7 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index 9bbf8a4b2108..3d8382bbc331 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -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