Re: [PATCH v10 28/40] sched/deadline: Start a period for a task that enters the class blocked

From: sashiko-bot

Date: Fri Nov 20 2026 - 16:21:31 EST


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] sched/deadline: dl_boost_blocked() skips departed tasks with
dl_deadline
--

commit 83a90ad95f7f2d67e4562e7ef1ff35c08c85da9f
Author: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>

sched/deadline: Start a period for a task that enters the class blocked

This commit starts a deadline period for a task blocked on an rt_mutex
when it enters the deadline class or receives a new priority-inheritance
donor while having no deadline reservation of its own.

> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index aa12908aeaeab..ee3a08ff33458 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
[ ... ]
> @@ -1184,6 +1195,30 @@ static inline void replenish_dl_new_period(struct sched_dl_entity *dl_se,
> trace_sched_dl_replenish_tp(dl_se, cpu_of(rq), dl_get_type(dl_se, rq));
> }
>
> +#ifdef CONFIG_RT_MUTEXES
> +/*
> + * Start a period from the new donor of @p, if @p has no reservation of its
> + * own and waits on an rt_mutex. The enqueue does this for a queued task, in
> + * replenish_dl_entity(). A blocked task is not enqueued, but the chain walk
> + * copies its deadline into its waiter.
> + *
> + * The caller calls it only when the donor changes. A new period changes the
> + * deadline, so the chain walk finds the waiter out of date and goes on. In a
> + * ww_mutex cycle, a new period at each step would never let the walk stop.
> + *
> + * The caller holds the rq lock and the pi_lock of @p, and has updated the
> + * rq clock.
> + */
> +void dl_boost_blocked(struct task_struct *p)
> +{
> + struct sched_dl_entity *dl_se = &p->dl;
> +
> + if (!dl_se->dl_deadline && !dl_se->dl_throttled &&
> + dl_task_pi_blocked(p))
> + replenish_dl_new_period(dl_se, task_rq(p));
> +}
> +#endif

[Severity: Medium]
Can dl_boost_blocked() skip starting a period for a task that left
SCHED_DEADLINE before its 0-lag time?

When a deadline task switches to a non-deadline policy before its 0-lag
time, switched_from_dl() arms inactive_timer and leaves dl_se->dl_deadline
and dl_se->deadline non-zero until that timer fires. If the task blocks
on an rt_mutex and is boosted back into dl_sched_class before
dl_se->deadline passes, switched_to_dl() cancels inactive_timer (so
__dl_clear_params() never clears dl_se->dl_deadline while the task remains
boosted) and skips replenish_dl_new_period() because dl_se->deadline has
not passed yet.

Once dl_se->deadline does pass while the task is still blocked and boosted,
a subsequent boost by a new donor calls dl_boost_blocked(p), which sees
dl_se->dl_deadline != 0 and returns without replenishing. The chain walk
then requeues the waiter with the expired dl_se->deadline ahead of waiters
with current deadlines.

Checking !dl_prio(p->normal_prio) (or whether dl_se->deadline has passed)
instead of !dl_se->dl_deadline would cover tasks still carrying parameters
from before they left the class.

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