diff options
Diffstat (limited to 'kernel/sched/cpudeadline.c')
| -rw-r--r-- | kernel/sched/cpudeadline.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c index 539ca3ce071b..c6acb07466bb 100644 --- a/kernel/sched/cpudeadline.c +++ b/kernel/sched/cpudeadline.c | |||
| @@ -107,7 +107,8 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, | |||
| 107 | int best_cpu = -1; | 107 | int best_cpu = -1; |
| 108 | const struct sched_dl_entity *dl_se = &p->dl; | 108 | const struct sched_dl_entity *dl_se = &p->dl; |
| 109 | 109 | ||
| 110 | if (later_mask && cpumask_and(later_mask, later_mask, cp->free_cpus)) { | 110 | if (later_mask && |
| 111 | cpumask_and(later_mask, cp->free_cpus, &p->cpus_allowed)) { | ||
| 111 | best_cpu = cpumask_any(later_mask); | 112 | best_cpu = cpumask_any(later_mask); |
| 112 | goto out; | 113 | goto out; |
| 113 | } else if (cpumask_test_cpu(cpudl_maximum(cp), &p->cpus_allowed) && | 114 | } else if (cpumask_test_cpu(cpudl_maximum(cp), &p->cpus_allowed) && |
| @@ -186,6 +187,26 @@ out: | |||
| 186 | } | 187 | } |
| 187 | 188 | ||
| 188 | /* | 189 | /* |
| 190 | * cpudl_set_freecpu - Set the cpudl.free_cpus | ||
| 191 | * @cp: the cpudl max-heap context | ||
| 192 | * @cpu: rd attached cpu | ||
| 193 | */ | ||
| 194 | void cpudl_set_freecpu(struct cpudl *cp, int cpu) | ||
| 195 | { | ||
| 196 | cpumask_set_cpu(cpu, cp->free_cpus); | ||
| 197 | } | ||
| 198 | |||
| 199 | /* | ||
| 200 | * cpudl_clear_freecpu - Clear the cpudl.free_cpus | ||
| 201 | * @cp: the cpudl max-heap context | ||
| 202 | * @cpu: rd attached cpu | ||
| 203 | */ | ||
| 204 | void cpudl_clear_freecpu(struct cpudl *cp, int cpu) | ||
| 205 | { | ||
| 206 | cpumask_clear_cpu(cpu, cp->free_cpus); | ||
| 207 | } | ||
| 208 | |||
| 209 | /* | ||
| 189 | * cpudl_init - initialize the cpudl structure | 210 | * cpudl_init - initialize the cpudl structure |
| 190 | * @cp: the cpudl max-heap context | 211 | * @cp: the cpudl max-heap context |
| 191 | */ | 212 | */ |
| @@ -203,7 +224,7 @@ int cpudl_init(struct cpudl *cp) | |||
| 203 | if (!cp->elements) | 224 | if (!cp->elements) |
| 204 | return -ENOMEM; | 225 | return -ENOMEM; |
| 205 | 226 | ||
| 206 | if (!alloc_cpumask_var(&cp->free_cpus, GFP_KERNEL)) { | 227 | if (!zalloc_cpumask_var(&cp->free_cpus, GFP_KERNEL)) { |
| 207 | kfree(cp->elements); | 228 | kfree(cp->elements); |
| 208 | return -ENOMEM; | 229 | return -ENOMEM; |
| 209 | } | 230 | } |
| @@ -211,8 +232,6 @@ int cpudl_init(struct cpudl *cp) | |||
| 211 | for_each_possible_cpu(i) | 232 | for_each_possible_cpu(i) |
| 212 | cp->elements[i].idx = IDX_INVALID; | 233 | cp->elements[i].idx = IDX_INVALID; |
| 213 | 234 | ||
| 214 | cpumask_setall(cp->free_cpus); | ||
| 215 | |||
| 216 | return 0; | 235 | return 0; |
| 217 | } | 236 | } |
| 218 | 237 | ||
