aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Lameter <cl@linux.com>2023-10-29 19:24:25 -0700
committerChristopher Lameter <cl@linux.com>2023-10-29 19:24:25 -0700
commit92b8dcbce44892ef4322b94c8cee4c5fae8daae6 (patch)
tree0c8504ff23f1a9d32d738d9bae205347e2e042ac
parent2af9b20dbb39f6ebf9b9b6c090271594627d818e (diff)
downloadlinux-arm64_maxsmp.tar.gz
From: Christoph Lameter <cl@linux.com>arm64_maxsmp
Subject: [PATCH] ARM64: Introduce CONFIG_MAXSMP Ampere Computing develops high end ARM processor that support an ever increasing number of processors. The default 256 processors are not enough for our newer products. The default is used by distros and therefore our customers cannot use distro kernels because the number of processors is not supported. The x86 arch has support for a "CONFIG_MAXSMP" configuration option that enables support for the largest known configurations. This usually means hundreds or thousands of processors. For those sizes it is no longer practical to allocate bitmaps of cpus on the kernel stack. There is a kernel option CONFIG_CPUMASK_OFFSTACK that makes the kernel allocate and free bitmaps for cpu masks from slab memory instead of keeping it on the stack etc. With that is becomes possible to dynamically size the allocation of the bitmap depending on the quantity of processors detected on bootup. This patch enables that logic if CONFIG_MAXSMP is enabled. If CONFIG_MAXSMP is disabled then a default of 64 processors is supported. A bitmap for 64 processors fits into one word and therefore can be efficiently handled on the stack. Using a pointer to a bitmap would be overkill. The number of processors can be manually configured if CONFIG_MAXSMP is not set. Currently the default for CONFIG_MAXSMP is 512 processors. This will have to be increased if ARM processor vendors start supporting more processors. Signed-off-by: Christoph Lameter (Ampere) <cl@linux.com>
-rw-r--r--arch/arm64/Kconfig52
-rw-r--r--arch/arm64/configs/defconfig1
2 files changed, 50 insertions, 3 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 78f20e6327120e..71e7c688724ca3 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1402,10 +1402,56 @@ config SCHED_SMT
MultiThreading at a cost of slightly increased overhead in some
places. If unsure say N here.
+
+config MAXSMP
+ bool "Compile kernel with support for the maximum number of SMP Processors"
+ depends on SMP && DEBUG_KERNEL
+ select CPUMASK_OFFSTACK
+ help
+ Enable maximum number of CPUS and NUMA Nodes for this architecture.
+ If unsure, say N.
+
+#
+# The maximum number of CPUs supported:
+#
+# The main config value is NR_CPUS, which defaults to NR_CPUS_DEFAULT,
+# and which can be configured interactively in the
+# [NR_CPUS_RANGE_BEGIN ... NR_CPUS_RANGE_END] range.
+#
+# ( If MAXSMP is enabled we just use the highest possible value and disable
+# interactive configuration. )
+#
+
+config NR_CPUS_RANGE_BEGIN
+ int
+ default NR_CPUS_RANGE_END if MAXSMP
+ default 1 if !SMP
+ default 2
+
+config NR_CPUS_RANGE_END
+ int
+ default 8192 if SMP && CPUMASK_OFFSTACK
+ default 512 if SMP && !CPUMASK_OFFSTACK
+ default 1 if !SMP
+
+config NR_CPUS_DEFAULT
+ int
+ default 512 if MAXSMP
+ default 64 if SMP
+ default 1 if !SMP
+
config NR_CPUS
- int "Maximum number of CPUs (2-4096)"
- range 2 4096
- default "256"
+ int "Set maximum number of CPUs" if SMP && !MAXSMP
+ range NR_CPUS_RANGE_BEGIN NR_CPUS_RANGE_END
+ default NR_CPUS_DEFAULT
+ help
+ This allows you to specify the maximum number of CPUs which this
+ kernel will support. If CPUMASK_OFFSTACK is enabled, the maximum
+ supported value is 8192, otherwise the maximum value is 512. The
+ minimum value which makes sense is 2.
+
+ This is purely to save memory: each supported CPU adds about 8KB
+ to the kernel image.
config HOTPLUG_CPU
bool "Support for hot-pluggable CPUs"
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index a789119e6483b5..4e34aefce7a364 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -15,6 +15,7 @@ CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_NUMA_BALANCING=y
+CONFIG_MAXSMP=y
CONFIG_MEMCG=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_PIDS=y