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

From: Mathieu Desnoyers

Date: Wed Nov 18 2026 - 08:42:37 EST


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

Yes, as on v6. Both cases are real, and upstream. But deadline 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. The cover letter of the
next version lists this under "Not changed". This was checked again by
reading.

> What happens when sched_setattr() changes the policy of a task
> blocked on an rt_mutex that is already in dl_sched_class due to a PI
> boost?

The class does not change, so switched_to_dl() does not run. The waiter
keeps the deadline that the boost gave it. But a sleeping deadline task
starts its own period only at its wakeup. This is the same wider
behaviour as in the first point. At the deboost, the task starts a
period of its own. Upstream left a deadline of 0 here.

> Conversely, when a blocked task leaves SCHED_DEADLINE
> (!dl_policy(policy)) while remaining boosted in dl_sched_class
> (dl_prio(newprio)), setting ENQUEUE_REPLENISH in
> __setscheduler_dl_pi() has no effect while !scope->queued because
> dl_boost_blocked() is not called.

dl_boost_blocked() would do nothing there. It only acts for a task with
no parameters of its own. A task that leaves the class keeps its
parameters and its deadline until its 0-lag time. A queued task boosted
back does the same. The new donor still reaches the next owner: pi_se
changed, so the chain walk goes on.

Both points were checked by reading.

Apart from these points, the next version changes this patch. A blocked
task starts a new period only when its donor changes. The reply on patch
9 says why.

Thanks,

Mathieu

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