public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: zalloc most of the cpu masks
@ 2009-11-02 10:07 Rusty Russell
  2009-11-02 16:16 ` [tip:sched/urgent] sched: Fix boot crash by zalloc()ing " tip-bot for Rusty Russell
  0 siblings, 1 reply; 2+ messages in thread
From: Rusty Russell @ 2009-11-02 10:07 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: linux-kernel

I got a boot crash when forcing cpumasks offstack on 32 bit, because
find_new_ilb() returned 3 on my UP system (nohz.cpu_mask wasn't zeroed).

AFAICT the others need to be zeroed too: only nohz.ilb_grp_nohz_mask is
initialized before use.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 kernel/sched.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -9532,13 +9541,13 @@ void __init sched_init(void)
 	current->sched_class = &fair_sched_class;
 
 	/* Allocate the nohz_cpu_mask if CONFIG_CPUMASK_OFFSTACK */
-	alloc_cpumask_var(&nohz_cpu_mask, GFP_NOWAIT);
+	zalloc_cpumask_var(&nohz_cpu_mask, GFP_NOWAIT);
 #ifdef CONFIG_SMP
 #ifdef CONFIG_NO_HZ
-	alloc_cpumask_var(&nohz.cpu_mask, GFP_NOWAIT);
+	zalloc_cpumask_var(&nohz.cpu_mask, GFP_NOWAIT);
 	alloc_cpumask_var(&nohz.ilb_grp_nohz_mask, GFP_NOWAIT);
 #endif
-	alloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
+	zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
 #endif /* SMP */
 
 	perf_event_init();

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip:sched/urgent] sched: Fix boot crash by zalloc()ing most of the cpu masks
  2009-11-02 10:07 [PATCH] sched: zalloc most of the cpu masks Rusty Russell
@ 2009-11-02 16:16 ` tip-bot for Rusty Russell
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Rusty Russell @ 2009-11-02 16:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, rusty, peterz, tglx, mingo

Commit-ID:  49557e620339cb134127b5bfbcfecc06b77d0232
Gitweb:     http://git.kernel.org/tip/49557e620339cb134127b5bfbcfecc06b77d0232
Author:     Rusty Russell <rusty@rustcorp.com.au>
AuthorDate: Mon, 2 Nov 2009 20:37:20 +1030
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 2 Nov 2009 15:48:54 +0100

sched: Fix boot crash by zalloc()ing most of the cpu masks

I got a boot crash when forcing cpumasks offstack on 32 bit,
because find_new_ilb() returned 3 on my UP system (nohz.cpu_mask
wasn't zeroed).

AFAICT the others need to be zeroed too: only
nohz.ilb_grp_nohz_mask is initialized before use.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <200911022037.21282.rusty@rustcorp.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index cae6700..bf21adb 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -9535,13 +9535,13 @@ void __init sched_init(void)
 	current->sched_class = &fair_sched_class;
 
 	/* Allocate the nohz_cpu_mask if CONFIG_CPUMASK_OFFSTACK */
-	alloc_cpumask_var(&nohz_cpu_mask, GFP_NOWAIT);
+	zalloc_cpumask_var(&nohz_cpu_mask, GFP_NOWAIT);
 #ifdef CONFIG_SMP
 #ifdef CONFIG_NO_HZ
-	alloc_cpumask_var(&nohz.cpu_mask, GFP_NOWAIT);
+	zalloc_cpumask_var(&nohz.cpu_mask, GFP_NOWAIT);
 	alloc_cpumask_var(&nohz.ilb_grp_nohz_mask, GFP_NOWAIT);
 #endif
-	alloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
+	zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
 #endif /* SMP */
 
 	perf_event_init();

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-02 16:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-02 10:07 [PATCH] sched: zalloc most of the cpu masks Rusty Russell
2009-11-02 16:16 ` [tip:sched/urgent] sched: Fix boot crash by zalloc()ing " tip-bot for Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox