Re: [PATCH v5 24/29] sched/deadline: Cancel the replenishment timer with the parameters

From: Juri Lelli

Date: Thu Nov 12 2026 - 04:48:10 EST


Hello,

On 08/11/26 13:54, Mathieu Desnoyers wrote:
> A task that leaves SCHED_DEADLINE has its parameters cleared at its
> 0-lag time. Its replenishment timer can still be armed then. If the
> task comes back and throttles before that timer fires, start_dl_timer()
> does not restart it, since it is queued. The replenishment would then
> come at the period of the reservation the task left. Too early, it would
> give the task runtime it has not earned. Too late, it would delay the
> task by up to a period.
>
> Commit a649f237db18 ("sched,dl: Fix sched class hopping CBS hole") armed
> the replenishment timer when a task leaves the class. The timer then
> reset the task if it was still out. Commit 209a0cbda7a0
> ("sched/deadline: Improve the tracking of active utilization") moved
> that reset to the inactive timer, at the 0-lag time. Nothing cancels
> the replenishment timer there.
>
> The timer of a throttled task fires at its next period, which can come
> after the 0-lag time:
> - A task that yielded is throttled with runtime left. Its 0-lag time
> comes before its deadline.
> - A constrained-deadline task that overran by little reaches its 0-lag
> time before the end of its period.
>
> Fix this by cancelling the timer where the parameters are cleared. This
> includes switched_from_dl(), when it releases the bandwidth of a task
> that leaves asleep past its 0-lag time. A constrained task that overran
> as it blocked has the timer armed there too.
>
> The Sashiko AI review of the first posting of this series found this.
> It has no reproducer.
>
> Fixes: 209a0cbda7a0 ("sched/deadline: Improve the tracking of active utilization")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
> ---

Reviewed-by: Juri Lelli <juri.lelli@xxxxxxxxxx>

Thanks,
Juri