diff options
Diffstat (limited to 'kernel/sched/cpupri.c')
-rw-r--r-- | kernel/sched/cpupri.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c index 8b836b376d91..8834243abee2 100644 --- a/kernel/sched/cpupri.c +++ b/kernel/sched/cpupri.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/gfp.h> | 30 | #include <linux/gfp.h> |
31 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
32 | #include <linux/sched/rt.h> | 32 | #include <linux/sched/rt.h> |
33 | #include <linux/slab.h> | ||
33 | #include "cpupri.h" | 34 | #include "cpupri.h" |
34 | 35 | ||
35 | /* Convert between a 140 based task->prio, and our 102 based cpupri */ | 36 | /* Convert between a 140 based task->prio, and our 102 based cpupri */ |
@@ -70,8 +71,7 @@ int cpupri_find(struct cpupri *cp, struct task_struct *p, | |||
70 | int idx = 0; | 71 | int idx = 0; |
71 | int task_pri = convert_prio(p->prio); | 72 | int task_pri = convert_prio(p->prio); |
72 | 73 | ||
73 | if (task_pri >= MAX_RT_PRIO) | 74 | BUG_ON(task_pri >= CPUPRI_NR_PRIORITIES); |
74 | return 0; | ||
75 | 75 | ||
76 | for (idx = 0; idx < task_pri; idx++) { | 76 | for (idx = 0; idx < task_pri; idx++) { |
77 | struct cpupri_vec *vec = &cp->pri_to_cpu[idx]; | 77 | struct cpupri_vec *vec = &cp->pri_to_cpu[idx]; |
@@ -219,8 +219,13 @@ int cpupri_init(struct cpupri *cp) | |||
219 | goto cleanup; | 219 | goto cleanup; |
220 | } | 220 | } |
221 | 221 | ||
222 | cp->cpu_to_pri = kcalloc(nr_cpu_ids, sizeof(int), GFP_KERNEL); | ||
223 | if (!cp->cpu_to_pri) | ||
224 | goto cleanup; | ||
225 | |||
222 | for_each_possible_cpu(i) | 226 | for_each_possible_cpu(i) |
223 | cp->cpu_to_pri[i] = CPUPRI_INVALID; | 227 | cp->cpu_to_pri[i] = CPUPRI_INVALID; |
228 | |||
224 | return 0; | 229 | return 0; |
225 | 230 | ||
226 | cleanup: | 231 | cleanup: |
@@ -237,6 +242,7 @@ void cpupri_cleanup(struct cpupri *cp) | |||
237 | { | 242 | { |
238 | int i; | 243 | int i; |
239 | 244 | ||
245 | kfree(cp->cpu_to_pri); | ||
240 | for (i = 0; i < CPUPRI_NR_PRIORITIES; i++) | 246 | for (i = 0; i < CPUPRI_NR_PRIORITIES; i++) |
241 | free_cpumask_var(cp->pri_to_cpu[i].mask); | 247 | free_cpumask_var(cp->pri_to_cpu[i].mask); |
242 | } | 248 | } |