public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH] arm: allow single CPU configuration by adjusting NR_CPUS range and defaults
@ 2025-07-24 17:26 Suchit Karunakaran
  2025-07-24 17:45 ` Russell King (Oracle)
  0 siblings, 1 reply; 3+ messages in thread
From: Suchit Karunakaran @ 2025-07-24 17:26 UTC (permalink / raw)
  To: linux, rmk+kernel, ardb, linus.walleij, ebiggers, nathan, lumag,
	dave, ruanjinjie, kees, liuyuntao12, linux-arm-kernel
  Cc: skhan, linux-kernel-mentees, linux-kernel, Suchit Karunakaran

Previously, the NR_CPUS config for ARM required a minimum of 2 CPUs.
This patch changes the minimum NR_CPUS to 1 when SMP is not enabled,
sets range to exactly 1 if !SMP, allowing only a single CPU setting and
adds conditional defaults:
    - default to 1 if SMP is disabled (uniprocessor)
    - default to 4 if SMP is enabled (multiprocessor)

Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com>
---
 arch/arm/Kconfig | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3072731fe09c..23acee38721e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1063,11 +1063,13 @@ config KASAN_SHADOW_OFFSET
 	default 0xffffffff
 
 config NR_CPUS
-	int "Maximum number of CPUs (2-32)"
+	int "Maximum number of CPUs (1-32)"
+	range 1 1 if !SMP
 	range 2 16 if DEBUG_KMAP_LOCAL
 	range 2 32 if !DEBUG_KMAP_LOCAL
 	depends on SMP
-	default "4"
+	default "1" if !SMP
+	default "4" if SMP
 	help
 	  The maximum number of CPUs that the kernel can support.
 	  Up to 32 CPUs can be supported, or up to 16 if kmap_local()
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: allow single CPU configuration by adjusting NR_CPUS range and defaults
  2025-07-24 17:26 [PATCH] arm: allow single CPU configuration by adjusting NR_CPUS range and defaults Suchit Karunakaran
@ 2025-07-24 17:45 ` Russell King (Oracle)
  2025-07-24 17:57   ` Suchit K
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King (Oracle) @ 2025-07-24 17:45 UTC (permalink / raw)
  To: Suchit Karunakaran
  Cc: ardb, linus.walleij, ebiggers, nathan, lumag, dave, ruanjinjie,
	kees, liuyuntao12, linux-arm-kernel, skhan, linux-kernel-mentees,
	linux-kernel

On Thu, Jul 24, 2025 at 10:56:03PM +0530, Suchit Karunakaran wrote:
> Previously, the NR_CPUS config for ARM required a minimum of 2 CPUs.
> This patch changes the minimum NR_CPUS to 1 when SMP is not enabled,
> sets range to exactly 1 if !SMP, allowing only a single CPU setting and
> adds conditional defaults:
>     - default to 1 if SMP is disabled (uniprocessor)
>     - default to 4 if SMP is enabled (multiprocessor)
> 
> Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com>

This hasn't been tested. NR_CPUS depends on SMP, so if SMP is not
enabled, then NR_CPUS doesn't exist in the configuration. Therefore,
providing a default for !SMP is meaningless. 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: allow single CPU configuration by adjusting NR_CPUS range and defaults
  2025-07-24 17:45 ` Russell King (Oracle)
@ 2025-07-24 17:57   ` Suchit K
  0 siblings, 0 replies; 3+ messages in thread
From: Suchit K @ 2025-07-24 17:57 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: ardb, linus.walleij, ebiggers, nathan, lumag, dave, ruanjinjie,
	kees, liuyuntao12, linux-arm-kernel, skhan, linux-kernel-mentees,
	linux-kernel

On Thu, 24 Jul 2025 at 23:16, Russell King (Oracle)
<linux@armlinux.org.uk> wrote:
>
> On Thu, Jul 24, 2025 at 10:56:03PM +0530, Suchit Karunakaran wrote:
> > Previously, the NR_CPUS config for ARM required a minimum of 2 CPUs.
> > This patch changes the minimum NR_CPUS to 1 when SMP is not enabled,
> > sets range to exactly 1 if !SMP, allowing only a single CPU setting and
> > adds conditional defaults:
> >     - default to 1 if SMP is disabled (uniprocessor)
> >     - default to 4 if SMP is enabled (multiprocessor)
> >
> > Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com>
>
> This hasn't been tested. NR_CPUS depends on SMP, so if SMP is not
> enabled, then NR_CPUS doesn't exist in the configuration. Therefore,
> providing a default for !SMP is meaningless.
>

Oops, I think I misunderstood the intent of commit
278d1ed65e25d80af7c3a112d707b3f70516ddb4(cpumask: make CONFIG_NR_CPUS
always valid). And sorry for not testing it, I wasn't exactly sure how
to test it. Could you please point out the issues so I can fix them
properly? I appreciate your patience. I’m still learning my way around
kernel development and trying to improve. Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-24 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-24 17:26 [PATCH] arm: allow single CPU configuration by adjusting NR_CPUS range and defaults Suchit Karunakaran
2025-07-24 17:45 ` Russell King (Oracle)
2025-07-24 17:57   ` Suchit K

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox