Re: [PATCH v8 16/33] sched/deadline: Keep the last CPU a task has in its root domain

From: Mathieu Desnoyers

Date: Thu Nov 19 2026 - 15:24:11 EST


Hi Waiman,

This patch refuses a CPU offline when a deadline task would leave the
root domain that counts its bandwidth. It also refuses an offline that
makes a partition invalid, when a deadline task in it would change root
domain. To decide, it predicts the new effective CPUs of each cpuset
after the offline.

We checked the prediction against the cpuset code, cgroup-v2.rst and
test_cpuset_prs.sh. This is what we rely on. Please tell us if a point
is wrong:

1. A cpuset that is not a valid partition root keeps the CPUs of its
parent that its cpuset.cpus holds. If there are none, it takes all
of the parent's CPUs. cpuset.cpus.exclusive plays no part.

2. A valid partition root that keeps a CPU of its own only loses the
offline CPU. A child partition is made invalid only when its
populated parent has no other CPU left. The parent then takes the
CPUs of that child.

3. A populated partition that loses its last CPU is made invalid. It
then follows rule 1 against its parent. This holds for a local and
for a remote partition.

4. When the last CPU left to the top cpuset goes offline, every
partition is made invalid.

5. Any hotplug event tries each invalid partition again, an offline
too. So an offline can make a partition valid, when what blocked it
went away earlier.

6. housekeeping_update() can run during an offline, as the changelog of
a84097e625f2 says. We see no lock we could hold in the offline path.
So we read HK_TYPE_DOMAIN under RCU and accept an old value.

We have one question.

7. At an offline, select_fallback_rq() runs before the cpuset update.
cpuset_cpus_allowed_fallback() gives the task its cpuset.cpus, then
the housekeeping CPUs follow. A deadline task could land in another
root domain. The previous patch makes select_fallback_rq() give it
the CPUs of its root domain instead. The task can then run outside
its cpuset until the cpuset update sets its mask. The comment in
cpuset_cpus_allowed_fallback() already allows a temporary mask of
this kind. Is our case acceptable too? On cgroup v1, a task of the
top cpuset keeps that mask, as it keeps the housekeeping mask today.

One note on cgroup v1. When a cpuset is left with no CPU, a work item
moves its tasks to an ancestor. We refuse the offline when that move
would take a deadline task to another root domain. The attach has its
own admission test. But if it fails, cgroup_transfer_tasks() stops, and
the other tasks stay in the empty cpuset. Tell us if you prefer to let
the attach decide.

Thanks,

Mathieu