sched/deadline: switched_to_dl() -- skip if task is current
PATCH 1/1 sched/deadline: switched_to_dl() -- skip if task is current
When p is current and it's not of dl class, then there are no other dl taks in the rq. If we had had pushable tasks in some other rq, they would have been pushed earlier. So, skip "p == rq->curr" case.
This helps to skip excess schedule() when class is changed. The situation may be not rare. For example:
a small number of deadline tasks which have common rt_spinlocks with fair tasks. Priority inheritance mechanism does this every time it is acquiring a lock.
[This is confirmed by Juri Lelli and LKML was CC'ed, but
unfotunately I can't find direct link on lkml.org]
Signed-off-by Kirill Tkhai <[email protected]>
CC Juri Lelli <[email protected]>
CC Peter Zijlstra <[email protected]>
CC Ingo Molnar <[email protected]>
--- kernel/sched/deadline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/deadline.c +1 -1
@@ -1559,7 +1559,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)if (unlikely (p->dl.dl_throttled))return ; -if (p->on_rq || rq->curr != p) { +if (p->on_rq && rq->curr != p) {#ifdef CONFIG_SMP if (rq->dl.overloaded &&push_dl_task (rq) && rq !=task_rq (p))/* Only reschedule if pushing failed */