[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190506044836.2914-6-luca.abeni@santannapisa.it>
Date: Mon, 6 May 2019 06:48:35 +0200
From: Luca Abeni <luca.abeni@...tannapisa.it>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
"Paul E . McKenney" <paulmck@...ux.ibm.com>,
Joel Fernandes <joel@...lfernandes.org>,
Quentin Perret <quentin.perret@....com>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Morten Rasmussen <morten.rasmussen@....com>,
Juri Lelli <juri.lelli@...hat.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Patrick Bellasi <patrick.bellasi@....com>,
Tommaso Cucinotta <tommaso.cucinotta@...tannapisa.it>,
luca abeni <luca.abeni@...tannapisa.it>
Subject: [RFC PATCH 5/6] sched/dl: If the task does not fit anywhere, select the fastest core
From: luca abeni <luca.abeni@...tannapisa.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@...tannapisa.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
Powered by blists - more mailing lists