Re: [PATCH v9 32/33] sched/deadline: Check the runtime of a task whose parameters change

From: Mathieu Desnoyers

Date: Fri Nov 20 2026 - 14:44:30 EST


[ Sorry, I replied with the wrong content in the previous email for that
topics. ]

> Does dl_in_constrained_gap() (as well as dl_check_constrained_dl() and
> update_dl_entity()) mix the old dl_se->deadline with the newly overwritten
> dl_se->dl_deadline and dl_se->dl_period?

Your first case is not a bug. The task is implicit after the change.
update_dl_entity() then applies the wakeup rule of an implicit task. A
new period moves the deadline too, as at any wakeup.

Your second case: yes. It is older than this series: v7.4-rc2 also
finds the start of the period from deadline - dl_deadline. v10 will
keep the start of the period in a new field, period_start. The new
patch is "sched/deadline: Keep the start of the period across a change
of dl_deadline". A new case, wake_after_deadline_shrunk, will test it. It
fails without the fix.

> Can rt_mutex_setprio() skip dl_deboost() by comparing pi_task->dl.deadline
> against p->dl.deadline before dl_deboost() updates p->dl.deadline?

Yes, by reading. In v10, rt_mutex_setprio() will deboost a task with
new parameters first. dl_deboost() then checks them, and the waiter is
compared with the deadline that comes out. A new case,
boost_new_params_stale, will test it. It fails without the fix.

> When dl_deboost() returns early on dl_in_constrained_gap(dl_se) for a
> running task (or when sched_setattr() puts a running task into a
> constrained gap), who calls resched_curr(rq) after enqueue_dl_entity()
> throttles it?

Nobody. It is older than this series. On v7.4-rc2, any change of a
running constrained task in its gap gets there. sched_setattr(), an
affinity change and a cgroup move all do. v10 will fix it in a new patch,
"sched/deadline: Reschedule a running task throttled at its enqueue".
dl_check_constrained_dl() will call resched_curr() for the running
task. A new case, constrained_gap_change_running, will test it. It
fails without the fix.

> Does returning early on dl_in_constrained_gap(dl_se) in dl_deboost() (and
> prio_changed_dl()), or calling update_dl_entity(dl_se) unconditionally
> afterward, break PI boosting and sleeping tasks?

First: yes. v7.4-rc2 also compares the waiter with the expired deadline
of the owner. v10 will compare the waiter with the deadline that the
owner would run on. A new patch will do that: "sched/deadline: Boost an
owner that cannot run on its own reservation". An owner that is
throttled, or in its constrained gap, cannot run on its own reservation.
So any deadline waiter boosts it. New cases, pi_owner_asleep_in_gap and
pi_owner_throttled, will test it. Both fail without the fix.

Second: yes. v7.4-rc2 sorts such a waiter the same way. It is your
second finding on patch 26. v10 will list it as a known limit.

Third: yes. In v10, dl_deboost() will check the new parameters only for
a task that is queued or blocked on an rt_mutex. A task asleep on
anything else keeps the check for its wakeup. A new case,
deboost_asleep_new_params, will test it. It fails without the fix.

> When update_dl_entity() here (or in prio_changed_dl()) starts a new period
> for an unboosted rt_mutex owner and pushes p->dl.deadline past its top
> waiter's deadline, does anything PI-boost p with that waiter?

No. This is how a boost works, here and on v7.4-rc2. A boost never
gives the owner the deadline of its waiter. It stops the throttle, and
the refills use the donor's parameters. So EDF can rank an owner after
its waiter after any new period, not only after a change of parameters.
v10 will not change this.

> Should switched_to_dl() also handle p->dl.dl_new_params for a task blocked
> on an rt_mutex?

Yes, by reading. v10 will check the new parameters of a blocked task in
sched_setattr() itself, in a new helper, dl_check_blocked_params(). It
also runs when the task comes back to the class, and clears the mark.
rt_mutex_adjust_pi() then requeues the waiter. A new case,
setattr_blocked_reenter, will test it. It fails without the fix.

> Can consuming p->dl.dl_new_params in prio_changed_dl() desynchronize
> p->dl.deadline from the task's rt_mutex waiter node when prio_changed_dl()
> is reached from callers other than __sched_setscheduler()?

Yes, by reading. The same helper fixes it. v10 will remove the check
from prio_changed_dl(). A mark left for later is then consumed only at
the wakeup enqueue or at the deboost. No case will test it. It needs a
boost or a gap to end while the task stays blocked, then a move.

Thanks,

Mathieu

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