Messages in this thread Patch in this message | | | From | Luca Abeni <> | Subject | [RFC PATCH 5/6] sched/dl: If the task does not fit anywhere, select the fastest core | Date | Mon, 6 May 2019 06:48:35 +0200 |
| |
From: luca abeni <luca.abeni@santannapisa.it>
When a task has a remaining runtime that cannot be served within the scheduling deadline by anyone of the idle cores, the task is doomed to miss its deadline (this can happen, because the admission control only guarantees a bounded tardiness, not the hard respect of all deadlines). In this case, try to select the fastest idle core, to minimize the tardiness.
Signed-off-by: luca abeni <luca.abeni@santannapisa.it> --- kernel/sched/cpudeadline.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c index 111dd9ac837b..2a4ac7b529b7 100644 --- a/kernel/sched/cpudeadline.c +++ b/kernel/sched/cpudeadline.c @@ -123,7 +123,7 @@ static inline int dl_task_fit(const struct sched_dl_entity *dl_se, } if (c) - *c = cap; + *c = arch_scale_cpu_capacity(NULL, cpu); if ((rel_deadline * cap) >> SCHED_CAPACITY_SHIFT < rem_runtime) return 0; @@ -146,14 +146,22 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, if (later_mask && cpumask_and(later_mask, cp->free_cpus, &p->cpus_allowed)) { - int cpu; + int cpu, max_cpu = -1; + u64 max_cap = 0; for_each_cpu(cpu, later_mask) { u64 cap; if (!dl_task_fit(&p->dl, cpu, &cap)) cpumask_clear_cpu(cpu, later_mask); + + if (cap > max_cap) { + max_cap = cap; + max_cpu = cpu; + } } + if (cpumask_empty(later_mask) && max_cap) + cpumask_set_cpu(max_cpu, later_mask); if (!cpumask_empty(later_mask)) return 1; -- 2.20.1
| |