linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Randy Dunlap <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, torvalds@linux-foundation.org,
	peterz@infradead.org, rdunlap@infradead.org,
	torvalds@linuxfoundation.org, mingo@kernel.org,
	linux-kernel@vger.kernel.org, tglx@linutronix.de
Subject: [tip:x86/urgent] x86/Kconfig: Simplify NR_CPUS config
Date: Sun, 11 Feb 2018 04:11:42 -0800	[thread overview]
Message-ID: <tip-a0d0bb4deba831085d3eeb32d39fe73713ce6eb2@git.kernel.org> (raw)
In-Reply-To: <0b833246-ed4b-e451-c426-c4464725be92@infradead.org>

Commit-ID:  a0d0bb4deba831085d3eeb32d39fe73713ce6eb2
Gitweb:     https://git.kernel.org/tip/a0d0bb4deba831085d3eeb32d39fe73713ce6eb2
Author:     Randy Dunlap <rdunlap@infradead.org>
AuthorDate: Fri, 9 Feb 2018 16:51:03 -0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 11 Feb 2018 11:51:33 +0100

x86/Kconfig: Simplify NR_CPUS config

Clean up and simplify the X86 NR_CPUS Kconfig symbol/option by
introducing RANGE_BEGIN_CPUS, RANGE_END_CPUS, and DEF_CONFIG_CPUS.
Then combine some default values when their conditionals can be
reduced.

Also move the X86_BIGSMP kconfig option inside an "if X86_32"/"endif"
config block and drop its explicit "depends on X86_32".

Combine the max. 8192 cases of RANGE_END_CPUS (X86_64 only).
Split RANGE_END_CPUS and DEF_CONFIG_CPUS into separate cases for
X86_32 and X86_64.

Suggested-by: Linus Torvalds <torvalds@linuxfoundation.org>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/0b833246-ed4b-e451-c426-c4464725be92@infradead.org
Link: lkml.kernel.org/r/CA+55aFzOd3j6ZUSkEwTdk85qtt1JywOtm3ZAb-qAvt8_hJ6D4A@mail.gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/Kconfig | 57 +++++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 42 insertions(+), 15 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 63bf349..9d921b7 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -423,12 +423,6 @@ config X86_MPPARSE
 	  For old smp systems that do not have proper acpi support. Newer systems
 	  (esp with 64bit cpus) with acpi support, MADT and DSDT will override it
 
-config X86_BIGSMP
-	bool "Support for big SMP systems with more than 8 CPUs"
-	depends on X86_32 && SMP
-	---help---
-	  This option is needed for the systems that have more than 8 CPUs
-
 config GOLDFISH
        def_bool y
        depends on X86_GOLDFISH
@@ -460,6 +454,12 @@ config INTEL_RDT
 	  Say N if unsure.
 
 if X86_32
+config X86_BIGSMP
+	bool "Support for big SMP systems with more than 8 CPUs"
+	depends on SMP
+	---help---
+	  This option is needed for the systems that have more than 8 CPUs
+
 config X86_EXTENDED_PLATFORM
 	bool "Support for extended (non-PC) x86 platforms"
 	default y
@@ -949,17 +949,44 @@ config MAXSMP
 	  Enable maximum number of CPUS and NUMA Nodes for this architecture.
 	  If unsure, say N.
 
+config RANGE_END_CPUS
+	int
+	depends on X86_32
+	default 8 if SMP && !X86_BIGSMP
+	default 64 if SMP && X86_BIGSMP
+	default 1 if !SMP
+
+config RANGE_END_CPUS
+	int
+	depends on X86_64
+	default 512 if SMP && !MAXSMP && !CPUMASK_OFFSTACK
+	default 8192 if SMP && (MAXSMP || CPUMASK_OFFSTACK)
+	default 1 if !SMP
+
+config RANGE_BEGIN_CPUS
+	int
+	default 1 if !SMP
+	default RANGE_END_CPUS if MAXSMP
+	default 2
+
+config DEF_CONFIG_CPUS
+	int
+	depends on X86_32
+	default 1 if !SMP
+	default 32 if X86_BIGSMP
+	default 8 if SMP
+
+config DEF_CONFIG_CPUS
+	int
+	depends on X86_64
+	default 1 if !SMP
+	default 8192 if MAXSMP
+	default 64 if SMP
+
 config NR_CPUS
 	int "Maximum number of CPUs" if SMP && !MAXSMP
-	range 2 8 if SMP && X86_32 && !X86_BIGSMP
-	range 2 64 if SMP && X86_32 && X86_BIGSMP
-	range 2 512 if SMP && !MAXSMP && !CPUMASK_OFFSTACK && X86_64
-	range 2 8192 if SMP && !MAXSMP && CPUMASK_OFFSTACK && X86_64
-	default "1" if !SMP
-	default "8192" if MAXSMP
-	default "32" if SMP && X86_BIGSMP
-	default "8" if SMP && X86_32
-	default "64" if SMP
+	range RANGE_BEGIN_CPUS RANGE_END_CPUS
+	default DEF_CONFIG_CPUS
 	---help---
 	  This allows you to specify the maximum number of CPUs which this
 	  kernel will support.  If CPUMASK_OFFSTACK is enabled, the maximum

      parent reply	other threads:[~2018-02-12  1:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-09 22:01 [PATCH] x86: try to simplify NR_CPUS config Randy Dunlap
2018-02-09 22:39 ` Linus Torvalds
2018-02-10  0:51   ` [PATCH v2] x86: " Randy Dunlap
2018-02-10 11:36     ` [PATCH] x86/Kconfig: Further simplify the " Ingo Molnar
2018-02-10 11:38       ` Ingo Molnar
2018-02-10 17:37         ` Randy Dunlap
2018-02-10 22:19         ` Linus Torvalds
2018-02-11  1:11           ` Randy Dunlap
2018-02-11 10:47             ` Ingo Molnar
2018-02-11 10:50           ` Ingo Molnar
2018-02-11 12:12       ` [tip:x86/urgent] " tip-bot for Ingo Molnar
2018-02-11 12:11     ` tip-bot for Randy Dunlap [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-a0d0bb4deba831085d3eeb32d39fe73713ce6eb2@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=torvalds@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).