Skip to content

Commit 2bed598

Browse files
Sebastian Andrzej Siewiorgregkh
authored andcommitted
sched/rt: Add a missing rescheduling point
commit 619bd4a71874a8fd78eb6ccf9f272c5e98bcc7b7 upstream. Since the change in commit: fd7a4be ("sched, rt: Convert switched_{from, to}_rt() / prio_changed_rt() to balance callbacks") ... we don't reschedule a task under certain circumstances: Lets say task-A, SCHED_OTHER, is running on CPU0 (and it may run only on CPU0) and holds a PI lock. This task is removed from the CPU because it used up its time slice and another SCHED_OTHER task is running. Task-B on CPU1 runs at RT priority and asks for the lock owned by task-A. This results in a priority boost for task-A. Task-B goes to sleep until the lock has been made available. Task-A is already runnable (but not active), so it receives no wake up. The reality now is that task-A gets on the CPU once the scheduler decides to remove the current task despite the fact that a high priority task is enqueued and waiting. This may take a long time. The desired behaviour is that CPU0 immediately reschedules after the priority boost which made task-A the task with the lowest priority. Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Thomas Gleixner <tglx@linutronix.de> Fixes: fd7a4be ("sched, rt: Convert switched_{from, to}_rt() prio_changed_rt() to balance callbacks") Link: http://lkml.kernel.org/r/20170124144006.29821-1-bigeasy@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7a52021 commit 2bed598

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

kernel/sched/deadline.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,12 +1771,11 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
17711771
#ifdef CONFIG_SMP
17721772
if (p->nr_cpus_allowed > 1 && rq->dl.overloaded)
17731773
queue_push_tasks(rq);
1774-
#else
1774+
#endif
17751775
if (dl_task(rq->curr))
17761776
check_preempt_curr_dl(rq, p, 0);
17771777
else
17781778
resched_curr(rq);
1779-
#endif
17801779
}
17811780
}
17821781

kernel/sched/rt.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,10 +2136,9 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)
21362136
#ifdef CONFIG_SMP
21372137
if (p->nr_cpus_allowed > 1 && rq->rt.overloaded)
21382138
queue_push_tasks(rq);
2139-
#else
2139+
#endif /* CONFIG_SMP */
21402140
if (p->prio < rq->curr->prio)
21412141
resched_curr(rq);
2142-
#endif /* CONFIG_SMP */
21432142
}
21442143
}
21452144

0 commit comments

Comments
 (0)