From: Guopeng Zhang <guopeng.zhang@linux.dev>
To: Ridong Chen <ridong.chen@linux.dev>,
Waiman Long <longman@redhat.com>, Tejun Heo <tj@kernel.org>
Cc: "Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutný" <mkoutny@suse.com>,
"Shuah Khan" <shuah@kernel.org>,
"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
"Guopeng Zhang" <zhangguopeng@kylinos.cn>
Subject: Re: [PATCH v3 2/3] cgroup/cpuset: Allow top-level partition CPU replacement
Date: Wed, 11 Nov 2026 18:53:50 +0800 [thread overview]
Message-ID: <586335c2-3c46-4723-a139-a60bd601e86b@linux.dev> (raw)
In-Reply-To: <d615a099-5369-4e34-8f48-17152ce000d6@linux.dev>
在 2026/11/10 20:11, Ridong Chen 写道:
>
>
> On 11/10/2026 1:03 PM, Guopeng Zhang wrote:
>> From: Guopeng Zhang <zhangguopeng@kylinos.cn>
>>
>> When replacing a partition's CPUs, tasks_nocpu_error() checks whether
>> the parent's current effective_cpus is a subset of the new exclusive
>> CPU mask. The parent mask does not yet include CPUs being returned by
>> the update, so this can invalidate an otherwise valid partition.
>>
>> For example, on an 8-CPU system without boot isolation:
>>
>> echo 2-7 > A/cpuset.cpus
>> echo isolated > A/cpuset.cpus.partition
>> echo 0-4 > A/cpuset.cpus
>> cat A/cpuset.cpus.partition
>> isolated invalid (Parent unable to distribute cpu downstream)
>>
>> The update should return CPUs 5-7 to the parent and leave A as a
>> valid isolated partition.
>>
>> Skip this subset check for top_cpuset. top_cpuset_sd_nocpu() already
>> accounts for returned CPUs and ensures that an active boot domain
>> housekeeping CPU remains.
>>
>> Add a regression test for this case.
>>
>> Fixes: 0c7f293efc87 ("cgroup/cpuset: Add cpuset.cpus.exclusive.effective for v2")
>> Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
>
> Hi Guopeng,
>
> Patch 2 depends on patch 1. Skipping the cpumask_subset() check for
> top_cpuset is only safe because top_cpuset_sd_nocpu() added by patch 1
> now covers it. Without patch 1, patch 2 alone would let a partition
> take away all the CPUs of top_cpuset. So patch 2 can't be backported
> on its own, and the two have different Fixes tags. I think it would be
> better to fold patch 2 into patch 1.
>
Thanks for the review. That makes sense. I hadn't considered the backport implications.
> Also, the fix in patch 2 seems incomplete. The same false PERR_NOCPUS
> happens when the parent is a local partition, as cpumask_subset()
> there doesn't take the CPUs given back by the update into account
> either. On an 8-CPU system:
>
> cd /sys/fs/cgroup
> echo +cpuset > cgroup.subtree_control
> mkdir A1
> echo 1-7 > A1/cpuset.cpus
> echo root > A1/cpuset.cpus.partition
> echo +cpuset > A1/cgroup.subtree_control
> mkdir A1/A2
> echo 3-7 > A1/A2/cpuset.cpus
> echo isolated > A1/A2/cpuset.cpus.partition
> sleep 1000 &
> echo $! > A1/cgroup.procs
> echo 1-4 > A1/A2/cpuset.cpus
> cat A1/A2/cpuset.cpus.partition
> isolated invalid (Parent unable to distribute cpu downstream)
>
You're right. I'll fix this in the next version.
Thanks,
Guopeng
> A2 takes CPUs 1-2 from A1 and gives CPUs 5-7 back, so A1 still has
> CPUs for its task. Instead of skipping the check for top_cpuset only,
> how about making the check in tasks_nocpu_error() account for the CPUs
> given back by cs for all parents? The hotplug caller would then need
> to not count cs->effective_xcpus as given back, similar to what patch 3
> does for top-level partitions.
>
next prev parent reply other threads:[~2026-11-11 10:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 5:03 [PATCH v3 0/3] cgroup/cpuset: Keep the top scheduling domain populated Guopeng Zhang
2026-11-10 5:03 ` [PATCH v3 1/3] cgroup/cpuset: Reject updates that empty the top sched domain Guopeng Zhang
2026-11-10 12:13 ` Ridong Chen
2026-11-11 10:51 ` Guopeng Zhang
2026-11-10 5:03 ` [PATCH v3 2/3] cgroup/cpuset: Allow top-level partition CPU replacement Guopeng Zhang
2026-11-10 12:11 ` Ridong Chen
2026-11-11 10:53 ` Guopeng Zhang [this message]
2026-11-10 5:03 ` [PATCH v3 3/3] cgroup/cpuset: Keep the top sched domain non-empty on CPU hotplug Guopeng Zhang
2026-11-10 12:55 ` Ridong Chen
2026-11-11 10:56 ` Guopeng Zhang
2026-11-11 12:19 ` Guopeng Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=586335c2-3c46-4723-a139-a60bd601e86b@linux.dev \
--to=guopeng.zhang@linux.dev \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mkoutny@suse.com \
--cc=ridong.chen@linux.dev \
--cc=shuah@kernel.org \
--cc=tj@kernel.org \
--cc=zhangguopeng@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.