Re: [PATCH v12 26/43] sched/deadline: Keep a departing constrained task until its next period
From: Mathieu Desnoyers
Date: Tue Dec 01 2026 - 11:19:44 EST
> Can a departing constrained task still release its bandwidth and lose its
> deadline at the 0-lag time when task_non_contending() races with
> inactive_task_timer()?
Yes. In v13, the new flag dl_inactive_pending will tell whether
inactive_task_timer() still has to act on the task.
task_non_contending() sets it when it arms the timer. The handler clears
it under the rq lock, before it returns HRTIMER_NORESTART. If the flag
is set, task_non_contending() will leave a departing task to the
handler. Otherwise, it will go on as if no timer were armed.
> Does canceling the restarted inactive_timer only in task_non_contending()
> miss a task that returns to SCHED_DEADLINE while inactive_task_timer() is
> returning HRTIMER_RESTART?
Yes. The timer then stays queued for the next period. This alone does no
harm. When it fires, the handler finds dl_non_contending clear, and does
nothing. Exit is the exception: see the next answer. In v12, the task
can leave SCHED_DEADLINE again before the restarted timer fires. Then
task_non_contending() releases its bandwidth at once. In v13, the
restarting handler keeps dl_inactive_pending set, so
task_non_contending() will leave the task to it.
> Can that leftover restarted inactive_timer leak running_bw and this_bw on
> the runqueue if it expires while the task is exiting in do_task_dead()?
Yes. In v13, the handler will leave alone a deadline task whose
dl_non_contending is clear, even a dying one. It will no longer clear
the parameters of such a task. The last dequeue of the task then finds
them, and removes its bandwidth.
Thanks,
Mathieu