From: Yinghai Lu <yinghai@kernel.org>
To: Suresh Siddha <suresh.b.siddha@intel.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
"ananth@in.ibm.com" <ananth@in.ibm.com>,
Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>
Subject: [RFC PATCH 1/4] use nr_cpus= to set nr_cpu_ids early
Date: Mon, 11 Jan 2010 18:48:00 -0800 [thread overview]
Message-ID: <1263264483-3959-1-git-send-email-yinghai@kernel.org> (raw)
on x86, before prefill_possible_map(), nr_cpu_ids will be NR_CPUS aka CONFIG_NR_CPUS
add nr_cpus= to set nr_cpu_ids. so we can simulate cpus <=8 on normal config.
instead of change NR_CPUS directly.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/ia64/kernel/acpi.c | 4 ++--
arch/x86/kernel/smpboot.c | 7 ++++---
init/main.c | 14 ++++++++++++++
3 files changed, 20 insertions(+), 5 deletions(-)
Index: linux-2.6/init/main.c
===================================================================
--- linux-2.6.orig/init/main.c
+++ linux-2.6/init/main.c
@@ -149,6 +149,20 @@ static int __init nosmp(char *str)
early_param("nosmp", nosmp);
+/* this is hard limit */
+static int __init nrcpus(char *str)
+{
+ int nr_cpus;
+
+ get_option(&str, &nr_cpus);
+ if (nr_cpus > 0 && nr_cpus < nr_cpu_ids)
+ nr_cpu_ids = nr_cpus;
+
+ return 0;
+}
+
+early_param("nr_cpus", nrcpus);
+
static int __init maxcpus(char *str)
{
get_option(&str, &setup_max_cpus);
Index: linux-2.6/arch/ia64/kernel/acpi.c
===================================================================
--- linux-2.6.orig/arch/ia64/kernel/acpi.c
+++ linux-2.6/arch/ia64/kernel/acpi.c
@@ -883,8 +883,8 @@ __init void prefill_possible_map(void)
possible = available_cpus + additional_cpus;
- if (possible > NR_CPUS)
- possible = NR_CPUS;
+ if (possible > nr_cpu_ids)
+ possible = nr_cpu_ids;
printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n",
possible, max((possible - available_cpus), 0));
Index: linux-2.6/arch/x86/kernel/smpboot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/smpboot.c
+++ linux-2.6/arch/x86/kernel/smpboot.c
@@ -1213,11 +1213,12 @@ __init void prefill_possible_map(void)
total_cpus = max_t(int, possible, num_processors + disabled_cpus);
- if (possible > CONFIG_NR_CPUS) {
+ /* nr_cpu_ids could be reduced via nr_cpus= */
+ if (possible > nr_cpu_ids) {
printk(KERN_WARNING
"%d Processors exceeds NR_CPUS limit of %d\n",
- possible, CONFIG_NR_CPUS);
- possible = CONFIG_NR_CPUS;
+ possible, nr_cpu_ids);
+ possible = nr_cpu_ids;
}
printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n",
next reply other threads:[~2010-01-12 2:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-12 2:48 Yinghai Lu [this message]
2010-01-12 2:48 ` [RFC PATCH 3/4] x86: using logical flat for amd cpu too Yinghai Lu
2010-01-12 3:16 ` Linus Torvalds
2010-01-12 8:47 ` Yinghai Lu
2010-01-12 8:27 ` Ananth N Mavinakayanahalli
2010-01-12 22:50 ` H. Peter Anvin
2010-01-13 4:53 ` Ananth N Mavinakayanahalli
2010-01-12 2:48 ` [RFC PATCH 4/4] x86: according to nr_cpu_ids to decide if need to leave logical flat Yinghai Lu
2010-01-12 3:20 ` Linus Torvalds
2010-01-12 8:50 ` Yinghai Lu
2010-01-12 2:48 ` [RFC PATCH 2/4] x86: use dmi check to treat disabled cpus as hotplug cpus Yinghai Lu
2010-01-12 3:13 ` Linus Torvalds
2010-01-12 8:59 ` Yinghai Lu
2010-01-12 15:19 ` Linus Torvalds
2010-01-12 17:54 ` Suresh Siddha
2010-01-12 18:13 ` Yinghai Lu
2010-01-12 18:24 ` Suresh Siddha
2010-01-12 19:19 ` Yinghai Lu
2010-01-12 9:15 ` Yinghai Lu
2010-01-12 9:46 ` Ingo Molnar
2010-01-12 16:14 ` Valdis.Kletnieks
2010-01-12 16:26 ` Linus Torvalds
2010-01-12 17:17 ` Valdis.Kletnieks
2010-01-12 3:06 ` [RFC PATCH 1/4] use nr_cpus= to set nr_cpu_ids early Linus Torvalds
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=1263264483-3959-1-git-send-email-yinghai@kernel.org \
--to=yinghai@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ananth@in.ibm.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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