public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: rusty@rustcorp.com.au, mingo@elte.hu, peterz@infradead.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] sched: Fix isolcpus boot option
Date: Mon, 30 Nov 2009 11:05:32 +1100	[thread overview]
Message-ID: <20091130000532.GW32182@kryten> (raw)


We allocate and zero cpu_isolated_map after the isolcpus __setup option
has run. This means cpu_isolated_map always ends up empty and if
CPUMASK_OFFSTACK is enabled we write to a cpumask that hasn't been
allocated.

To keep the fix to a minimum this patch stores a pointer to the cmdline
option and parses it after we allocate and zero the cpumask.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Might be worth moving cpu_isolated_map into kernel/cpu.c and treat it
like the other cpu masks but I figured that change would have trouble
making 2.6.32. Thoughts?

Index: linux.trees.git/kernel/sched.c
===================================================================
--- linux.trees.git.orig/kernel/sched.c	2009-11-28 09:35:29.000000000 +1100
+++ linux.trees.git/kernel/sched.c	2009-11-28 21:50:44.000000000 +1100
@@ -8098,10 +8098,14 @@ cpu_attach_domain(struct sched_domain *s
 /* cpus with isolated domains */
 static cpumask_var_t cpu_isolated_map;
 
-/* Setup the mask of cpus configured for isolated domains */
+/*
+ * Since it's too early to allocate cpu_isolated_map we just store
+ * a pointer to the parameter and allocate and initialize it in sched_init
+ */
+static __initdata char *isolated_cpu_str;
 static int __init isolated_cpu_setup(char *str)
 {
-	cpulist_parse(str, cpu_isolated_map);
+	isolated_cpu_str = str;
 	return 1;
 }
 
@@ -9650,6 +9654,7 @@ void __init sched_init(void)
 	alloc_cpumask_var(&nohz.ilb_grp_nohz_mask, GFP_NOWAIT);
 #endif
 	zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
+	cpulist_parse(isolated_cpu_str, cpu_isolated_map);
 #endif /* SMP */
 
 	perf_event_init();

             reply	other threads:[~2009-11-30  0:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30  0:05 Anton Blanchard [this message]
2009-11-30  8:31 ` [PATCH] sched: Fix isolcpus boot option Peter Zijlstra
2009-12-01  0:44 ` Rusty Russell
2009-12-02  3:39 ` Rusty Russell
2009-12-02 10:45   ` [tip:sched/core] " tip-bot for Rusty Russell

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=20091130000532.GW32182@kryten \
    --to=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    /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