Skip to content

Commit aec6487

Browse files
author
Ingo Molnar
committed
x86/Kconfig: Further simplify the NR_CPUS config
Clean up various aspects of the x86 CONFIG_NR_CPUS configuration switches: - Rename the three CONFIG_NR_CPUS related variables to create a common namespace for them: RANGE_BEGIN_CPUS => NR_CPUS_RANGE_BEGIN RANGE_END_CPUS => NR_CPUS_RANGE_END DEF_CONFIG_CPUS => NR_CPUS_DEFAULT - Align them vertically, such as: config NR_CPUS_RANGE_END int depends on X86_64 default 8192 if SMP && ( MAXSMP || CPUMASK_OFFSTACK) default 512 if SMP && (!MAXSMP && !CPUMASK_OFFSTACK) default 1 if !SMP - Update help text, add more comments. Test results: # i386 allnoconfig: CONFIG_NR_CPUS_RANGE_BEGIN=1 CONFIG_NR_CPUS_RANGE_END=1 CONFIG_NR_CPUS_DEFAULT=1 CONFIG_NR_CPUS=1 # i386 defconfig: CONFIG_NR_CPUS_RANGE_BEGIN=2 CONFIG_NR_CPUS_RANGE_END=8 CONFIG_NR_CPUS_DEFAULT=8 CONFIG_NR_CPUS=8 # i386 allyesconfig: CONFIG_NR_CPUS_RANGE_BEGIN=2 CONFIG_NR_CPUS_RANGE_END=64 CONFIG_NR_CPUS_DEFAULT=32 CONFIG_NR_CPUS=32 # x86_64 allnoconfig: CONFIG_NR_CPUS_RANGE_BEGIN=1 CONFIG_NR_CPUS_RANGE_END=1 CONFIG_NR_CPUS_DEFAULT=1 CONFIG_NR_CPUS=1 # x86_64 defconfig: CONFIG_NR_CPUS_RANGE_BEGIN=2 CONFIG_NR_CPUS_RANGE_END=512 CONFIG_NR_CPUS_DEFAULT=64 CONFIG_NR_CPUS=64 # x86_64 allyesconfig: CONFIG_NR_CPUS_RANGE_BEGIN=8192 CONFIG_NR_CPUS_RANGE_END=8192 CONFIG_NR_CPUS_DEFAULT=8192 CONFIG_NR_CPUS=8192 Acked-by: Randy Dunlap <[email protected]> Acked-by: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent a0d0bb4 commit aec6487

File tree

1 file changed

+40
-26
lines changed

1 file changed

+40
-26
lines changed

arch/x86/Kconfig

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -949,52 +949,66 @@ config MAXSMP
949949
Enable maximum number of CPUS and NUMA Nodes for this architecture.
950950
If unsure, say N.
951951

952-
config RANGE_END_CPUS
952+
#
953+
# The maximum number of CPUs supported:
954+
#
955+
# The main config value is NR_CPUS, which defaults to NR_CPUS_DEFAULT,
956+
# and which can be configured interactively in the
957+
# [NR_CPUS_RANGE_BEGIN ... NR_CPUS_RANGE_END] range.
958+
#
959+
# The ranges are different on 32-bit and 64-bit kernels, depending on
960+
# hardware capabilities and scalability features of the kernel.
961+
#
962+
# ( If MAXSMP is enabled we just use the highest possible value and disable
963+
# interactive configuration. )
964+
#
965+
966+
config NR_CPUS_RANGE_BEGIN
953967
int
954-
depends on X86_32
955-
default 8 if SMP && !X86_BIGSMP
956-
default 64 if SMP && X86_BIGSMP
957-
default 1 if !SMP
968+
default NR_CPUS_RANGE_END if MAXSMP
969+
default 1 if !SMP
970+
default 2
958971

959-
config RANGE_END_CPUS
972+
config NR_CPUS_RANGE_END
960973
int
961-
depends on X86_64
962-
default 512 if SMP && !MAXSMP && !CPUMASK_OFFSTACK
963-
default 8192 if SMP && (MAXSMP || CPUMASK_OFFSTACK)
964-
default 1 if !SMP
974+
depends on X86_32
975+
default 64 if SMP && X86_BIGSMP
976+
default 8 if SMP && !X86_BIGSMP
977+
default 1 if !SMP
965978

966-
config RANGE_BEGIN_CPUS
979+
config NR_CPUS_RANGE_END
967980
int
968-
default 1 if !SMP
969-
default RANGE_END_CPUS if MAXSMP
970-
default 2
981+
depends on X86_64
982+
default 8192 if SMP && ( MAXSMP || CPUMASK_OFFSTACK)
983+
default 512 if SMP && (!MAXSMP && !CPUMASK_OFFSTACK)
984+
default 1 if !SMP
971985

972-
config DEF_CONFIG_CPUS
986+
config NR_CPUS_DEFAULT
973987
int
974988
depends on X86_32
975-
default 1 if !SMP
976-
default 32 if X86_BIGSMP
977-
default 8 if SMP
989+
default 32 if X86_BIGSMP
990+
default 8 if SMP
991+
default 1 if !SMP
978992

979-
config DEF_CONFIG_CPUS
993+
config NR_CPUS_DEFAULT
980994
int
981995
depends on X86_64
982-
default 1 if !SMP
983-
default 8192 if MAXSMP
984-
default 64 if SMP
996+
default 8192 if MAXSMP
997+
default 64 if SMP
998+
default 1 if !SMP
985999

9861000
config NR_CPUS
9871001
int "Maximum number of CPUs" if SMP && !MAXSMP
988-
range RANGE_BEGIN_CPUS RANGE_END_CPUS
989-
default DEF_CONFIG_CPUS
1002+
range NR_CPUS_RANGE_BEGIN NR_CPUS_RANGE_END
1003+
default NR_CPUS_DEFAULT
9901004
---help---
9911005
This allows you to specify the maximum number of CPUs which this
9921006
kernel will support. If CPUMASK_OFFSTACK is enabled, the maximum
9931007
supported value is 8192, otherwise the maximum value is 512. The
9941008
minimum value which makes sense is 2.
9951009

996-
This is purely to save memory - each supported CPU adds
997-
approximately eight kilobytes to the kernel image.
1010+
This is purely to save memory: each supported CPU adds about 8KB
1011+
to the kernel image.
9981012

9991013
config SCHED_SMT
10001014
bool "SMT (Hyperthreading) scheduler support"

0 commit comments

Comments
 (0)