Skip to content

Commit 64be6f1

Browse files
Juri LelliIngo Molnar
authored andcommitted
sched/deadline: Don't replenish from a !SCHED_DEADLINE entity
In the deboost path, right after the dl_boosted flag has been reset, we can currently end up replenishing using -deadline parameters of a !SCHED_DEADLINE entity. This of course causes a bug, as those parameters are empty. In the case depicted above it is safe to simply bail out, as the deboosted task is going to be back to its original scheduling class anyway. Reported-by: Daniel Wagner <[email protected]> Tested-by: Daniel Wagner <[email protected]> Signed-off-by: Juri Lelli <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: [email protected] Cc: Dario Faggioli <[email protected]> Cc: Michael Trimarchi <[email protected]> Cc: Fabio Checconi <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent eeb61e5 commit 64be6f1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

kernel/sched/deadline.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,19 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
847847
* smaller than our one... OTW we keep our runtime and
848848
* deadline.
849849
*/
850-
if (pi_task && p->dl.dl_boosted && dl_prio(pi_task->normal_prio))
850+
if (pi_task && p->dl.dl_boosted && dl_prio(pi_task->normal_prio)) {
851851
pi_se = &pi_task->dl;
852+
} else if (!dl_prio(p->normal_prio)) {
853+
/*
854+
* Special case in which we have a !SCHED_DEADLINE task
855+
* that is going to be deboosted, but exceedes its
856+
* runtime while doing so. No point in replenishing
857+
* it, as it's going to return back to its original
858+
* scheduling class after this.
859+
*/
860+
BUG_ON(!p->dl.dl_boosted || flags != ENQUEUE_REPLENISH);
861+
return;
862+
}
852863

853864
/*
854865
* If p is throttled, we do nothing. In fact, if it exhausted

0 commit comments

Comments
 (0)