Re: [PATCH v6 31/37] sched/deadline: Start a period for a task that enters the class blocked

From: Mathieu Desnoyers

Date: Tue Nov 17 2026 - 09:18:18 EST


> Does gating replenish_dl_new_period() on dl_task_pi_blocked(p) leave
> p->dl.deadline at 0 when a sleeping task participates in rt_mutex priority
> inheritance before waking up?

Both cases are real, and upstream. But a deadline of 0 is one case of a
wider behaviour. A deadline task that sleeps keeps the deadline of its
last period. After a long sleep, that deadline is far in the past. It
sorts first at a requeue_pi, and it blocks the boost of a sleeping
owner, as 0 does. This happens with or without a class change.

This patch fixes the case where the task already waits on the rt_mutex
when it enters the class. Refreshing the deadline of a sleeping task in
the rt_mutex paths would be a separate change.

> If p->dl.dl_throttled is still set, switched_to_dl() skips
> replenish_dl_new_period() and leaves p throttled with its expired deadline;
> if p->dl.dl_timer then fires while p is boosted, dl_task_timer() bails out
> on is_dl_boosted(dl_se) without clearing dl_throttled

Right, and upstream. The planned next version has a separate patch for
it: dl_task_timer() replenishes a boosted task that sleeps.

> Even when p is not
> throttled, if its old pre-0-lag p->dl.deadline is still in the future,
> switched_to_dl() skips replenish_dl_new_period() and the chain walk sorts p
> using its abandoned reservation's deadline instead of the donor's.

This is intended. A queued task boosted back keeps its deadline too.
replenish_dl_entity() keeps the deadline and the runtime of a task with
parameters of its own, while it has runtime left. The blocked task now
gets the same. The task keeps its parameters until its 0-lag time, so
that leaving the class and coming back gains nothing.

> Does starting a period in switched_to_dl() leave p->dl.deadline stale if the
> top PI donor on a blocked task changes while it remains in dl_sched_class?

Yes. Fixed in the planned next version: a boost of a blocked task with
no parameters of its own starts a period from the new donor.

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com