Re: [PATCH v14 01/39] sched/deadline: Hold a reference on the deadline donor of a boosted task

From: Mathieu Desnoyers

Date: Fri Dec 04 2026 - 13:39:05 EST


On Fri, Dec 04, 2026 at 01:03:35PM -0500, Mathieu Desnoyers wrote:
> The fallback itself is safe. The top waiter is blocked, so it cannot
> exit. The boosted task then runs on the parameters of the top waiter.
> They are not those of the head of the chain, but they come from a live
> task.

This was incomplete. In a chain, the top waiter is often a boosted
SCHED_OTHER task, with no deadline parameters of its own. After the
fallback, replenish_dl_entity() finds no parameters in the donor. It
gives the owner a deadline of now and no runtime, at every tick. The
owner then runs ahead of every deadline task on its CPU.

The same state happens without the fallback. When the donor of a
blocked, boosted task changes, the owners below it keep the old donor.
The blocked task keeps prio -1, and its dl.deadline does not change
while it sleeps. So rt_mutex_adjust_prio_chain() sees no change at
step [3], and stops before the owners below it.

One CPU. O and M are SCHED_OTHER. A (10ms/100ms) and B (20ms/200ms)
are SCHED_DEADLINE. L1 and L2 are PI futexes. A takes L1 with a
timeout:

O M A B

locks L2
spins locks L1
blocks on L2
blocks on L1
M, O: donor A
blocks on L1
top waiter: A
times out on L1
M: donor B
O: still donor A
exits
0-lag time:
parameters cleared
replenish_dl_entity(O):
A's parameters are 0
deadline = now

The "no parameters" branch comes from "sched/deadline: Do not
replenish a boost from cleared parameters", in the first series. Its
changelog expects the deboost to come "soon enough". Here no walk
reaches O before it releases L2.

I reproduced this on v14, in a VM with one CPU, with proxy execution
on and off. A third deadline task runs a 3ms job every 50ms, with a
50ms deadline. From A's 0-lag time until O releases L2, two jobs out
of three miss their deadline. In the control run, A stays alive after
its timeout, and no job misses its deadline. A debug printk confirmed
the donors of M and O, and the refills of O.

The walk stops at M upstream too: the series does not change
rtmutex.c. Upstream, O would read the freed task_struct of A. This is
from reading: I did not run upstream. This patch fixes that, but its
changelog is wrong in three places:
- "for a while": the owner keeps the exited donor until it releases
the lock.
- "The boost is then only less accurate": not when the top waiter has
no parameters (see above).
- "it needs a walk preempted at the right step": the scenario above
needs none.

Neither v14 nor dropping the WARN, as planned in my previous mail,
fixes this.

Thanks,

Mathieu

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