Re: [PATCH v7 29/40] sched/deadline: Keep the last CPU a task has in its root domain
From: Mathieu Desnoyers
Date: Wed Nov 18 2026 - 08:41:54 EST
> Does cpuset_cpus_allowed_without() return an overly wide mask when it
> walks past an intermediate ancestor to find remaining active CPUs?
Yes, thanks. cgroup v2 computes the CPUs from the top down. The walk up
skipped a parent that then inherits wider CPUs. The next version starts
from the nearest valid partition root, or the top cpuset, that keeps an
active CPU. It then works down to the cpuset of the task with
effective_cpus_below(), as compute_effective_cpumask() does. Patch 30
already used that helper for cpuset writes. It moves into this patch.
cgroup v1 keeps the walk up.
This was found by reading. A new test case, hotplug_nested_refused,
tests it. On v7 the offline is accepted, and the task wakes up on an
isolated CPU. With the next version it fails with EBUSY. That held in
each of 6 runs on both.
> Can intersecting pmask with task_cpu_possible_mask(tsk) after the
> ancestor loop leave pmask empty when an ancestor has possible CPUs
> for tsk?
Yes. The possible mask must come before the empty test. The path is
select_fallback_rq(), though. The cpuset update fails on an empty mask
and leaves the mask alone. The wakeup then tries cpuset.cpus, then
task_cpu_fallback_mask(). Patch 28 makes each step prefer a CPU of the
span. So the bandwidth leaves only if none of those CPUs is in the span.
The next version stops the walk at a cpuset with a CPU the task can run
on. If none is left, select_fallback_rq() picks the CPU, with the change
described below. The check now predicts that change too. This was
checked by reading. I have no asymmetric arm64 system to test
on.
A second read of this patch found a related gap. At an offline,
select_fallback_rq() runs before the cpuset update. A runnable deadline
task on the outgoing CPU is pushed away then. The fallback uses
cpuset.cpus, then the housekeeping CPUs. These are not the CPUs that
this patch predicts. So a running task could leave its root domain while
the offline was accepted.
A new test case, hotplug_fallback_running, shows it. A deadline task
with a 2ms period runs on the outgoing CPU. On v7, the task left its
root domain in every run (8 runs). The next version changes
select_fallback_rq() in patch 28. When it would widen the mask out of
the root domain of the task, the task gets the CPUs of that root domain
instead. The cpuset update that follows sets the real mask. With that
change, the case passed in each run where it was not skipped.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com