Re: [PATCH v8 15/33] sched/deadline: Keep a task in the root domain that counts its bandwidth

From: Mathieu Desnoyers

Date: Fri Nov 20 2026 - 08:50:56 EST


> Can this overwrite task_cpu_fallback_mask(p) with span when state is
> already fail, and hit BUG() without ever scanning the fallback mask?

Yes, by reading. It needs cgroup v1 or no cpusets, and a deadline
kthread whose span has no usable active CPU. In v9, case fail will drop
the span and try the fallback mask once more before BUG().

> What happens here when p->cpus_ptr has no active CPUs left, but span
> still does?

The WARN and the pick of any active CPU come from v7.4-rc2. This series
does not change them. I would rather fix this in a follow-up: try an
active CPU of the span before the WARN.

> Can breaking out on dl_bw_move_blocked(p) leave p's bandwidth uncounted
> after a rebuild?

Yes, by reading. It needs the fallback of your previous point, during a
rebuild. v9 will fix it in two places:
- The stamp that v9 will add to patch 14 marks a task that the walk
leaves out. dl_bw_move_blocked() will not block a stamped task.
- dl_task_rebuild_cpu() will also take the CPU of a task queued outside
its mask, not only the CPU recorded.

> Are the sequence-counter memory barriers complete between
> dl_task_bw_span() and dl_clear_root_domains()?

No. x86 is not affected. v9 will read the counter with
smp_load_acquire(), end the rebuild with smp_store_release(), and read
rq->rd with READ_ONCE().

> Does this return NULL when an offlining CPU belongs to def_root_domain
> through runtime cpuset isolation rather than boot-time isolcpus=domain?

Yes. HK_TYPE_DOMAIN_BOOT does not know the CPUs of an isolated
partition. Patch 16 got a finding with the same cause. v9 will record
with each task whether def_root_domain counts its bandwidth, in a new
field, dl_bw_def. dl_task_bw_span() and the rebuild will use it instead
of the boot mask.

> Is it safe for callers to read the live rd->span cpumask returned here
> when they only hold p->pi_lock?

Not for select_fallback_rq(). v9 will add dl_task_bw_span_copy(). It
copies the span into a per-CPU mask, inside the window of the counter.
select_fallback_rq() will install that copy. The other callers only test
bits of the span. A rebuild that starts after the check can change such
a bit. The task can then be placed once on a CPU of the wrong root
domain. The walk after the rebuild still counts its bandwidth on the
side recorded with it.

Thanks,

Mathieu

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