Re: [PATCH v12 31/43] sched/deadline: Restore the owner's period at a deboost out of the class
From: sashiko-bot
Date: Fri Nov 27 2026 - 12:28:36 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] sched/deadline: unreplenished wakeup of boosted task with
zero runtime
--
commit 0aea8c212d9bcdc25976b70fd796e3d1b02c40e5
Author: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
sched/deadline: Restore the owner's period at a deboost out of the class
This commit restores a task's own deadline and runtime (or starts a new
period) in switched_from_dl() when leaving SCHED_DEADLINE after a donor
refill, and throttles unboosted tasks with no remaining runtime on
enqueue.
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 9c707512d93d8..6e20efb863594 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -3132,6 +3132,21 @@ enqueue_dl_entity(struct sched_dl_entity *dl_se, int flags)
> setup_new_dl_entity(dl_se);
> }
>
> + /*
> + * A task can come back to the class with no runtime left, before its
> + * deadline. It would run until the next tick. Throttle it now, until
> + * its next period, as update_curr_dl_se() would.
> + */
> + if (!dl_server(dl_se) && !is_dl_boosted(dl_se) &&
> + !dl_entity_is_special(dl_se) && dl_se->dl_runtime &&
> + !dl_se->dl_throttled && dl_se->runtime <= 0) {
> + struct rq *rq = rq_of_dl_se(dl_se);
> +
> + dl_se->dl_throttled = 1;
> + if (task_current_donor(rq, dl_task_of(dl_se)))
> + resched_curr(rq);
> + }
[Severity: Medium]
Can a task waking up while boosted be enqueued onto dl_rq with
dl_se->runtime == 0 and its exhausted own_deadline instead of being
replenished from its donor?
When switched_from_dl() calls dl_end_held_boost(&p->dl, false), a task
that exhausted its own runtime before the first donor refill leaves the
class with p->dl.runtime == 0, p->dl.deadline == own_deadline in the
future, and p->dl.dl_throttled == 0. If it then sleeps while holding an
rt_mutex and a SCHED_DEADLINE waiter boosts it back into the class before
own_deadline, neither rt_mutex_setprio() nor switched_to_dl() replenishes
it while asleep (and in the later commit "sched/deadline: Boost an owner
that cannot run on its own reservation", dl_boost_start() is skipped when
!dl_prio(p->normal_prio) and also returns early when !dl_se->dl_throttled
&& !dl_in_constrained_gap(dl_se)).
When the task wakes up before own_deadline, enqueue_dl_entity() with
ENQUEUE_WAKEUP calls update_dl_entity(), where both
dl_time_before(dl_se->deadline, rq_clock(rq)) and dl_entity_overflow() are
false because runtime is 0. Because the new dl_se->runtime <= 0 check
above skips is_dl_boosted(dl_se) without replenishing,
__enqueue_dl_entity() queues the boosted task with runtime == 0 and
deadline == own_deadline, causing EDF priority inversion when own_deadline
is later than a donor period's deadline.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795771147.git.mathieu.desnoyers@xxxxxxxxxxxx?part=31