Re: [PATCH v12 01/43] sched/deadline: Keep departing bandwidth across a root domain rebuild

From: Mathieu Desnoyers

Date: Tue Dec 01 2026 - 11:19:52 EST


> Can dl_clear_root_domains() charge departing bandwidth to the wrong root
> domain and underflow cpu_rq(cpu)->dl.extra_bw when dl_departed_cpu is
> moved into a new child cpuset partition root before the 0-lag timer
> fires?

Yes, until the 0-lag time of the departed tasks. Until then, the new
root domain counts their bandwidth. It can refuse tasks with EBUSY, and
extra_bw of the recorded CPU can underflow. The root domain of
top_cpuset does not count them, so it can admit tasks before that
bandwidth is free. At the 0-lag time, each release removes the bandwidth
from the root domain that counted it. The accounting is then exact
again. On v7.4-rc2, the rebuild drops that bandwidth from every root
domain, and the release removes it a second time. v13 does not fix it.
Its cover will list it as a known limit.

> When a departed task returns to SCHED_DEADLINE in the same root domain
> before its 0-lag timer fires, doesn't releasing p->dl.dl_bw after dropping
> dl_b->lock transiently double-count the task's old and new bandwidth in
> dl_b->total_bw and rq->dl.extra_bw?

Yes, for a short time. sched_dl_overflow() adds the new bandwidth under
dl_b->lock. Then dl_task_release_bw() takes that lock again, and removes
the old bandwidth. The release cannot run under the first lock:
dl_departed_lock is taken before any dl_bw lock. The double count errs
on the safe side. A check that runs meanwhile can refuse with EBUSY.

The admission check also passes old_bw = 0 for a task that comes back,
as on v7.4-rc2. It does not subtract the bandwidth that the task still
holds. So a task that comes back before its 0-lag time can get EBUSY in
a full root domain. v13 leaves both cases as they are. Its cover will
list them as a known limit.

Thanks,

Mathieu