public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix migration of SCHED_DEADLINE tasks
@ 2015-10-15 11:09 Luca Abeni
  2015-10-15 16:40 ` Juri Lelli
  0 siblings, 1 reply; 5+ messages in thread
From: Luca Abeni @ 2015-10-15 11:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Ingo Molnar, Wanpeng Li, Juri Lelli, Luca Abeni

Commit 9d5142624256 ("sched/deadline: Reduce rq lock contention by
eliminating locking of non-feasible target") broke select_task_rq_dl()
and find_lock_later_rq(), because it introduced a comparison between
the local task's deadline and dl.earliest_dl.curr of the remote queue.
However, if the remote runqueue does not contain any SCHED_DEADLINE
task its earliest_dl.curr is 0 (always smaller than the deadline of
the local task) and the remote runqueue is not selected for pushing.
As a result, if an application creates multiple SCHED_DEADLINE threads,
they will never be pushed to runqueues that do not already contain
SCHED_DEADLINE tasks.
This patches fixes the issue by checking if dl.earliest_dl.curr == 0.

Signed-off-by: Luca Abeni <luca.abeni@unitn.it>
---
 kernel/sched/deadline.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index fc8f010..0d86d60 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1066,8 +1066,9 @@ select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags)
 		int target = find_later_rq(p);
 
 		if (target != -1 &&
-				dl_time_before(p->dl.deadline,
-					cpu_rq(target)->dl.earliest_dl.curr))
+				(dl_time_before(p->dl.deadline,
+					cpu_rq(target)->dl.earliest_dl.curr) ||
+				(cpu_rq(target)->dl.earliest_dl.curr == 0)))
 			cpu = target;
 	}
 	rcu_read_unlock();
@@ -1417,7 +1418,8 @@ static struct rq *find_lock_later_rq(struct task_struct *task, struct rq *rq)
 
 		later_rq = cpu_rq(cpu);
 
-		if (!dl_time_before(task->dl.deadline,
+		if (later_rq->dl.earliest_dl.curr &&
+			!dl_time_before(task->dl.deadline,
 					later_rq->dl.earliest_dl.curr)) {
 			/*
 			 * Target rq has tasks of equal or earlier deadline,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-16  8:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 11:09 [PATCH] Fix migration of SCHED_DEADLINE tasks Luca Abeni
2015-10-15 16:40 ` Juri Lelli
2015-10-15 20:10   ` Luca Abeni
2015-10-16  8:03   ` Luca Abeni
2015-10-16  8:51     ` Juri Lelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox