Skip to contentSkip to conversation

sched: zalloc most of the cpu masks

PATCH In review Rusty Russell 1 participant 2 messages Nov 2, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: zalloc 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.

---
 kernel/sched.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/sched.c +3 -3
@@ -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();
#1 lore raw

[tip:sched/urgent] sched: Fix boot crash by zalloc()ing most of the cpu masks

Commit-ID:  49557e620339cb134127b5bfbcfecc06b77d0232
Gitweb:     http://git.kernel.org/tip/49557e620339cb134127b5bfbcfecc06b77d0232
Author:     Rusty Russell <[email protected]>
AuthorDate: Mon, 2 Nov 2009 20:37:20 +1030
Committer:  Ingo Molnar <[email protected]>
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.

LKML-Reference: <[email protected]>

---
 kernel/sched.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
kernel/sched.c +3 -3
index cae6700..bf21adb 100644
@@ -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();