Skip to content

Commit 0499a78

Browse files
Christoph Lameter (Ampere)ctmarinas
authored andcommitted
ARM64: Dynamically allocate cpumasks and increase supported CPUs to 512
Currently defconfig selects NR_CPUS=256, but some vendors (e.g. Ampere Computing) are planning to ship systems with 512 CPUs. So that all CPUs on these systems can be used with defconfig, we'd like to bump NR_CPUS to 512. Therefore this patch increases the default NR_CPUS from 256 to 512. As increasing NR_CPUS will increase the size of cpumasks, there's a fear that this might have a significant impact on stack usage due to code which places cpumasks on the stack. To mitigate that concern, we can select CPUMASK_OFFSTACK. As that doesn't seem to be a problem today with NR_CPUS=256, we only select this when NR_CPUS > 256. CPUMASK_OFFSTACK configures the cpumasks in the kernel to be dynamically allocated. This was used in the X86 architecture in the past to enable support for larger CPU configurations up to 8k cpus. With that is becomes possible to dynamically size the allocation of the cpu bitmaps depending on the quantity of processors detected on bootup. Memory used for cpumasks will increase if the kernel is run on a machine with more cores. Further increases may be needed if ARM processor vendors start supporting more processors. Given the current inflationary trends in core counts from multiple processor manufacturers this may occur. There are minor regressions for hackbench. The kernel data size for 512 cpus is smaller with offstack than with onstack. Benchmark results using hackbench average over 10 runs of hackbench -s 512 -l 2000 -g 15 -f 25 -P on Altra 80 Core Support for 256 CPUs on stack. Baseline 7.8564 sec Support for 512 CUs on stack. 7.8713 sec + 0.18% 512 CPUS offstack 7.8916 sec + 0.44% Kernel size comparison: text data filename Difference to onstack256 baseline 25755648 9589248 vmlinuz-6.8.0-rc4-onstack256 25755648 9607680 vmlinuz-6.8.0-rc4-onstack512 +0.19% 25755648 9603584 vmlinuz-6.8.0-rc4-offstack512 +0.14% Tested-by: Eric Mackay <[email protected]> Reviewed-by: Russell King (Oracle) <[email protected]> Signed-off-by: Christoph Lameter (Ampere) <[email protected]> Acked-by: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected] [[email protected]: use 'select' instead of duplicating 'config CPUMASK_OFFSTACK'] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 527db67 commit 0499a78

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/arm64/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ config ARM64
120120
select CLONE_BACKWARDS
121121
select COMMON_CLK
122122
select CPU_PM if (SUSPEND || CPU_IDLE)
123+
select CPUMASK_OFFSTACK if NR_CPUS > 256
123124
select CRC32
124125
select DCACHE_WORD_ACCESS
125126
select DYNAMIC_FTRACE if FUNCTION_TRACER
@@ -1424,7 +1425,7 @@ config SCHED_SMT
14241425
config NR_CPUS
14251426
int "Maximum number of CPUs (2-4096)"
14261427
range 2 4096
1427-
default "256"
1428+
default "512"
14281429

14291430
config HOTPLUG_CPU
14301431
bool "Support for hot-pluggable CPUs"

0 commit comments

Comments
 (0)