Re: [PATCH v6 26/37] sched/deadline: Keep a task in the root domain that counts its bandwidth

From: Mathieu Desnoyers

Date: Tue Nov 17 2026 - 09:20:50 EST


> Can find_lock_later_rq(p, rq) bypass the dl_task_bw_span(p) check and
> migrate p onto an isolated CPU in def_root_domain?

Yes. After the rebuild, the offline rq is in def_root_domain, so the
search only sees the isolated CPUs. The task and its bandwidth then
move there with no admission test. The planned next version drops that
result if the task still has an active CPU in its own root domain. It
then takes the fallback, which prefers that root domain.

> Does rejecting !cpu_active(cpu) here cause dl_task_bw_span() to return
> NULL while a CPU is being deactivated?

Yes. Until the rebuild, the root domain of that CPU still counts the
task. The planned next version returns its span in that window. It
returns NULL only for a housekeeping CPU that the rebuild already put
in def_root_domain. The same holds the other way: a task counted on an
isolated CPU that goes offline now stays on the isolated side.

A shorter window is left. The rebuild bumps dl_bw_gen before its walk
reaches each task. In between, dl_task_bw_span() returns NULL for that
task, and the CPU is picked without a preference. The window lasts one
walk of the task list.

> Because the new (recorded >= 0) block returns recorded whenever
> cpumask_test_cpu(recorded, msk) is true, the existing else-if branch
> right below this hunk is now unreachable:

Right. The planned next version drops the branch. It also refills the
mask before the test of the kind of CPU.

Thanks,

Mathieu

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