Re: [PATCH v7 36/40] sched/deadline: Check the runtime of a task whose parameters change

From: Mathieu Desnoyers

Date: Wed Nov 18 2026 - 08:43:00 EST


> Can a boosted SCHED_DEADLINE task with !dl_se->dl_donor_refill keep
> running on its old reservation's remaining runtime after
> sched_setattr() shrinks its parameters?

Yes, but its own runtime does not limit it while it is boosted. A
boosted task is never throttled. When its runtime runs out,
update_curr_dl_se() enqueues it with ENQUEUE_REPLENISH, and
replenish_dl_entity() refills it from the donor. A smaller runtime would
only bring the donor refill sooner. The CPU time during the boost is the
same. This is the inheritance design of 2d3d891d3344.

At the deboost, the runtime left is checked against the new parameters.
An implicit task keeps it only if it fits the new bandwidth until the
deadline. Patch 34 caps a constrained task at the new dl_runtime. That
is what a wakeup gives.

You are right that the comment is loose. Without a refill, the task runs
on its own runtime first. The next version says "A boosted task is
refilled from its donor."

> When a boosted task with dl_new_params set and !dl_se->dl_donor_refill
> is deboosted in rt_mutex_setprio(), does deferring update_dl_entity()
> until enqueue_dl_entity() miss the post-deboost re-boost check?

Yes, thanks. Patch 11 resets the donor refill in dl_deboost() for this
exact reason: the re-boost test and the chain walk read the deadline
before the enqueue. This patch left the check of the new parameters to
the enqueue. So the test read a deadline the check could still move. And
a blocked task was not checked before the chain walk.

The next version does the check in dl_deboost(), after dl_drop_boost(),
when the mark is set. The re-boost test then sees the result. A
throttled task is left to its replenishment, as at the enqueue.

A new test case, deboost_new_params_reboost, shows it. An owner shrinks
its parameters while boosted, and its donor times out. A deadline waiter
with an earlier deadline remains. On v7 the owner is not boosted again
and is throttled: its 20ms of work took 400ms in each of 40 runs. With
the next version it took about 20ms in each of 40 runs.

> Can calling update_dl_entity() on dl_new_params mix the previous
> period's dynamic state with the newly written static parameters when
> switching between constrained and implicit deadlines?

The first case gives the wakeup rule. A sleeping task changed the same
way, and woken at the same time, gets the same new period upstream.

It also gives no more than without this patch. Without it, the task
keeps its old runtime and deadline. dl_next_period() reads the new
parameters. So the timer refills the task with the new runtime at its
old deadline. The task then gets a little more than with this patch.

The excess is the run of the old reservation before the change.
sched_dl_overflow() gives that bandwidth back at once. Its XXX comment
says the old bandwidth should stay until the 0-lag time. The message of
this patch names that gap. It is not changed here.

In the second case, dl_check_constrained_dl() runs on every enqueue
upstream, including the one of sched_setattr(). This patch does not move
it. The task is throttled the same way on v7.4-rc2.

Both cases were checked by reading.

Thanks,

Mathieu

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