Re: [PATCH v11 31/43] sched/deadline: Restore the owner's period at a deboost out of the class

From: sashiko-bot

Date: Wed Nov 25 2026 - 20:50:46 EST


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] sched/deadline: missing throttle after held boost ends in
switched_from_dl()
--

commit 7695498ee5152a5e36e39a21aef4b92a39936d61
Author: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>

sched/deadline: Restore the owner's period at a deboost out of the class

This commit restores the lock owner's own deadline and runtime parameters
in switched_from_dl() when a priority-inheritance boost ends as the task
leaves SCHED_DEADLINE, and recalculates the 0-lag inactive timer from the
restored parameters.

> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 4d46d1c9c6981..5d1d4ea288788 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -4802,6 +4802,22 @@ void dl_clear_root_domains(void)
>
> static void switched_from_dl(struct rq *rq, struct task_struct *p)
> {
> + bool held = dl_end_held_boost(&p->dl);
> + bool own_period = held || (p->dl.dl_runtime && p->dl.dl_donor_refill);
> +
> + /*
> + * After a refill from the donor, the runtime and deadline are the
> + * donor's. task_non_contending() would mix them with the task's own
> + * dl_runtime and dl_period. So give the task values of its own first,
> + * as dl_deboost() does. After a held boost, dl_end_held_boost() above
> + * has put back the saved ones. A task with nothing saved starts a
> + * period of its own. Its 0-lag time is then now. A constrained task
> + * still keeps its bandwidth until its next period: see
> + * task_non_contending().
> + */
> + if (own_period && !held)
> + dl_start_own_period(&p->dl);

[Severity: Medium]
Should switched_from_dl() also throttle p->dl and arm p->dl.dl_timer when
held is true and p->dl.runtime <= 0, the way dl_deboost() does?

When a task exhausts its own runtime while boosted, replenish_dl_entity()
clears dl_throttled and dl_hold_refilled_boost() saves own_runtime = 0.
If the task leaves SCHED_DEADLINE at the deboost before own_deadline,
dl_end_held_boost() restores p->dl.deadline = own_deadline and
p->dl.runtime = 0, leaving p->dl.dl_throttled == 0.

If the task switches back to SCHED_DEADLINE before p->dl.deadline,
enqueue_dl_entity() sees dl_throttled == 0 and a deadline still in the
future, so it enqueues the task onto dl_rq with runtime == 0 and lets it
run past its reserved budget in the current period.

--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795646914.git.mathieu.desnoyers@xxxxxxxxxxxx?part=31