* [PATCH] cpumask: limit visibility of FORCE_NR_CPUS
@ 2022-10-19 5:22 Yury Norov
2022-10-19 11:22 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Yury Norov @ 2022-10-19 5:22 UTC (permalink / raw)
To: linux-kernel, Geert Uytterhoeven, Linus Torvalds,
Andy Shevchenko, Rasmus Villemoes, Andrew Morton,
Stephen Rothwell, Peter Zijlstra, Thomas Gleixner,
Paul E . McKenney, Vlastimil Babka, Dmitry Vyukov,
Valentin Schneider, Sander Vanheule, Alexey Klimov, Eric Biggers
Cc: 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.
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
lib/Kconfig | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/lib/Kconfig b/lib/Kconfig
index 9bbf8a4b2108..1ada12f5dda6 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
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] cpumask: limit visibility of FORCE_NR_CPUS
2022-10-19 5:22 [PATCH] cpumask: limit visibility of FORCE_NR_CPUS Yury Norov
@ 2022-10-19 11:22 ` Andy Shevchenko
2022-10-19 18:22 ` Yury Norov
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2022-10-19 11:22 UTC (permalink / raw)
To: Yury Norov
Cc: linux-kernel, Geert Uytterhoeven, Linus Torvalds,
Rasmus Villemoes, Andrew Morton, Stephen Rothwell,
Peter Zijlstra, Thomas Gleixner, Paul E . McKenney,
Vlastimil Babka, Dmitry Vyukov, Valentin Schneider,
Sander Vanheule, Alexey Klimov, Eric Biggers
On Tue, Oct 18, 2022 at 10:22:00PM -0700, Yury Norov wrote:
> 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.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cpumask: limit visibility of FORCE_NR_CPUS
2022-10-19 11:22 ` Andy Shevchenko
@ 2022-10-19 18:22 ` Yury Norov
2022-10-19 19:42 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: Yury Norov @ 2022-10-19 18:22 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-kernel, Geert Uytterhoeven, Linus Torvalds,
Rasmus Villemoes, Andrew Morton, Stephen Rothwell,
Peter Zijlstra, Thomas Gleixner, Paul E . McKenney,
Vlastimil Babka, Dmitry Vyukov, Valentin Schneider,
Sander Vanheule, Alexey Klimov, Eric Biggers
On Wed, Oct 19, 2022 at 02:22:40PM +0300, Andy Shevchenko wrote:
> On Tue, Oct 18, 2022 at 10:22:00PM -0700, Yury Norov wrote:
> > 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?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cpumask: limit visibility of FORCE_NR_CPUS
2022-10-19 18:22 ` Yury Norov
@ 2022-10-19 19:42 ` Geert Uytterhoeven
0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2022-10-19 19:42 UTC (permalink / raw)
To: Yury Norov
Cc: Andy Shevchenko, linux-kernel, Linus Torvalds, Rasmus Villemoes,
Andrew Morton, Stephen Rothwell, Peter Zijlstra, Thomas Gleixner,
Paul E . McKenney, Vlastimil Babka, Dmitry Vyukov,
Valentin Schneider, Sander Vanheule, Alexey Klimov, Eric Biggers
Hi Yuri,
On Wed, Oct 19, 2022 at 8:25 PM Yury Norov <yury.norov@gmail.com> wrote:
> On Wed, Oct 19, 2022 at 02:22:40PM +0300, Andy Shevchenko wrote:
> > On Tue, Oct 18, 2022 at 10:22:00PM -0700, Yury Norov wrote:
> > > 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?
> 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 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-10-19 19:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19 5:22 [PATCH] cpumask: limit visibility of FORCE_NR_CPUS Yury Norov
2022-10-19 11:22 ` Andy Shevchenko
2022-10-19 18:22 ` Yury Norov
2022-10-19 19:42 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).