Re: [PATCH v11 37/43] sched/deadline: Keep the debt of a task across a change of parameters

From: Mathieu Desnoyers

Date: Fri Nov 27 2026 - 08:49:34 EST


> Should dl_in_constrained_gap() check that dl_se->deadline is non-zero
> first, as dl_proxy_block() does?

Yes, in the first dl_period after boot. v12 will test for a deadline of
0 in dl_in_constrained_gap().

> Does dl_drop_boost_out() fit the period with different rules from the
> ones switched_from_dl() just used to arm inactive_timer?

Yes. In v12, dl_drop_boost_out() will call dl_setattr_place() with run
= false, as dl_zerolag_period() does. Out of the class, the task does
not go on in its job, and is not throttled. The inactive timer and the
period then agree.

> When a throttled constrained-deadline task leaves SCHED_DEADLINE, can
> replenishing it here in dl_task_timer() cause inactive_task_timer() to
> hold its bandwidth for an extra period?

Yes, and it errs on the safe side: see my reply on patch 26.

> Does testing (flags & ENQUEUE_CLASS) here run update_dl_entity() on a
> period that dl_setattr_period() has already fitted?

It can, but the debt lost is below about 2us. dl_entity_overflow()
truncates each factor to a multiple of 1024ns. A false overflow needs
a debt smaller than that error. v12 will leave it as it is.

> What happens if a sleeping task with a new constrained deadline wakes up
> before *deadline?

It is enqueued unthrottled with no runtime, and runs until the next
tick. The comment above dl_setattr_place() says that its wakeup
throttles it: that is wrong in v11. In v12, the enqueue will throttle
such a task until its next period (see my reply on patch 31). The
comment is then right.

> When a boosted task's bandwidth is reduced before any donor refill, does
> deferring the fit until deboost or refill repay the debt at the old
> bandwidth instead of the new one?

Yes for the first part. Until the deboost or the first refill, the
time since the change counts at the old bandwidth. The cover lists
this with the known limits. Its entry says: "a change of a boosted task
applies at its deboost, or at the refill that holds the boost".

The second part is not a problem. After a change back to the old
parameters, the fit goes from the old parameters to the same ones, so
it changes nothing.

> If a sleeping task has dl_non_contending set and sched_setattr() changes
> its period without changing dl_bw, can the old inactive_timer fire too
> early if the task then leaves SCHED_DEADLINE?

Yes. v12 will re-arm the inactive timer in __setparam_dl() after such
a change.

> Does zeroing or clamping dl_se->own_runtime before calling
> dl_setattr_place() corrupt the debt calculation?

Yes. In v12, the fit will get the runtime left even past the deadline.
Only an overrun is still saved as 0, since it comes from the boost.
Without a fit, the runtime left past the deadline is still dropped, as
before.

Thanks,

Mathieu