Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched/cpupri: Replace NR_CPUS arrays

Tejun reported that his resume was failing due to order-3 allocations
from sched_domain building.

Replace the NR_CPUS arrays in there with a dynamically allocated
array.

Reported-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/n/tip-7cysnkw1gik45r864t1nkudh@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Peter Zijlstra and committed by
Ingo Molnar
4dac0b63 944770ab

+8 -1
+7
kernel/sched/cpupri.c
··· 30 30 #include <linux/gfp.h> 31 31 #include <linux/sched.h> 32 32 #include <linux/sched/rt.h> 33 + #include <linux/slab.h> 33 34 #include "cpupri.h" 34 35 35 36 /* Convert between a 140 based task->prio, and our 102 based cpupri */ ··· 219 218 goto cleanup; 220 219 } 221 220 221 + cp->cpu_to_pri = kcalloc(nr_cpu_ids, sizeof(int), GFP_KERNEL); 222 + if (!cp->cpu_to_pri) 223 + goto cleanup; 224 + 222 225 for_each_possible_cpu(i) 223 226 cp->cpu_to_pri[i] = CPUPRI_INVALID; 227 + 224 228 return 0; 225 229 226 230 cleanup: ··· 242 236 { 243 237 int i; 244 238 239 + kfree(cp->cpu_to_pri); 245 240 for (i = 0; i < CPUPRI_NR_PRIORITIES; i++) 246 241 free_cpumask_var(cp->pri_to_cpu[i].mask); 247 242 }
+1 -1
kernel/sched/cpupri.h
··· 17 17 18 18 struct cpupri { 19 19 struct cpupri_vec pri_to_cpu[CPUPRI_NR_PRIORITIES]; 20 - int cpu_to_pri[NR_CPUS]; 20 + int *cpu_to_pri; 21 21 }; 22 22 23 23 #ifdef CONFIG_SMP