[PATCH] arm64: Kconfig: Don't select CPUMASK_OFFSTACK with 64K pages

Breno Leitao leitao at debian.org
Wed Oct 7 00:58:16 PDT 2026


arm64 selects CPUMASK_OFFSTACK when NR_CPUS is above 256, which keeps
cpumask_var_t off the kernel stack. With 64K pages the kernel stack is
64K as well, we have enough room to keep cpumask on the stack, avoiding
extra alocation and possible performance penalties.

Skip the select when ARM64_64K_PAGES is set. A 64K kernel can then raise
NR_CPUS above 256 and keep cpumask_var_t as an inline array. 4K and 16K
page kernels are unchanged.

Signed-off-by: Breno Leitao <leitao at debian.org>
---
Based on Will presentation at LPC, I've decided to have a look at Meta's
stack usage, and I found that this might be an small optimization!?
---
 arch/arm64/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 5f2db2cecf9772..b73371327d2a47 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -111,7 +111,7 @@ config ARM64
 	select CLONE_BACKWARDS
 	select COMMON_CLK
 	select CPU_PM if (SUSPEND || CPU_IDLE)
-	select CPUMASK_OFFSTACK if NR_CPUS > 256
+	select CPUMASK_OFFSTACK if NR_CPUS > 256 && !ARM64_64K_PAGES
 	select DCACHE_WORD_ACCESS
 	select HAVE_EXTRA_IPI_TRACEPOINTS
 	select DYNAMIC_FTRACE if FUNCTION_TRACER

---
base-commit: eea3fef32a9cf36abcb5975a5a594e4135a6b026
change-id: 20261007-arm_stack-fa76c2d0d69a

Best regards,
--  
Breno Leitao <leitao at debian.org>




More information about the linux-arm-kernel mailing list