From: Ridong Chen <ridong.chen@linux.dev>
To: "Waiman Long" <longman@redhat.com>, "Tejun Heo" <tj@kernel.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutný" <mkoutny@suse.com>,
"Shuah Khan" <shuah@kernel.org>
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Guopeng Zhang <guopeng.zhang@linux.dev>,
Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH-next v4 2/6] cgroup/cpuset: excpus parameter of remote_cpus_update() must have at least 1 active CPU
Date: Mon, 16 Nov 2026 11:07:00 +0800 [thread overview]
Message-ID: <e437ac79-7999-43da-9fe8-6cfd475a5196@linux.dev> (raw)
In-Reply-To: <20261116012330.2271010-3-longman@redhat.com>
On 11/16/2026 9:23 AM, Waiman Long wrote:
> It is reported that remote_cpus_update() fails to invalidate a
> populated remote partition when an ancestor cgroup update reduces its
> effective_xcpus mask to only offline CPUs.
>
> When update_cpumasks_hier() updates a descendant remote partition, it
> passes the new effective_xcpus mask (excpus) to remote_cpus_update().
> Because excpus still contains offline CPUs, cpumask_empty(excpus) is false
> and remote_cpus_update() only checks tasks_nocpu_error() when adding CPUs.
>
> With the partition left valid, update_cpumasks_hier() computes an empty
> effective_cpus mask and jumps to get_css. The populated partition stays
> valid with no effective CPUs instead of inheriting its parent's CPUs,
> and its tasks remain affine to the online CPUs returned to top_cpuset.
>
> Fix it by invalidating the remote partition if there is no active CPU
> available in the given excpus parameter.
>
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Link: https://sashiko.dev/#/bug/linux-936b7155-f652-4146-a4ab-ec48fd392a1d
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
> kernel/cgroup/cpuset.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 631fb449cef8..195d4e3a283c 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1810,7 +1810,8 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus,
>
> WARN_ON_ONCE(!cpumask_subset(cs->effective_xcpus, subpartitions_cpus));
>
> - if (cpumask_empty(excpus)) {
> + /* New effective_xcpus must have at least one active CPU */
> + if (!cpumask_intersects(excpus, cpu_active_mask)) {
> WRITE_ONCE(cs->prs_err, PERR_CPUSEMPTY);
> goto invalidate;
> }
This also invalidates a remote partition with no task whose excpus
only has offline CPUs. According to cgroup-v2.rst, such a partition
is valid: cpuset.cpus.exclusive.effective may contain offline CPUs,
and cpuset.cpus.effective can be empty if there is no task in the
partition. The hotplug path and tasks_nocpu_error() follow the same
rule. How about only invalidating it when it is populated?
if (cpumask_empty(excpus) ||
(!cpumask_intersects(excpus, cpu_active_mask) &&
partition_is_populated(cs, NULL))) {
Also, it probably needs a Fixes tag, maybe:
Fixes: f62a5d39368e ("cgroup/cpuset: Remove remote_partition_check() & make
update_cpumasks_hier() handle remote partition")
--
Best regards
Ridong
next prev parent reply other threads:[~2026-11-16 3:07 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 1:23 [PATCH-next v4 0/6] cgroup/cpuset: More fix patches Waiman Long
2026-11-16 1:23 ` [PATCH-next v4 1/6] cgroup/cpuset: Fix incorrect partition invalidation logic in cpuset_hotplug_update_tasks() Waiman Long
2026-11-16 10:19 ` Guopeng Zhang
2026-11-16 1:23 ` [PATCH-next v4 2/6] cgroup/cpuset: excpus parameter of remote_cpus_update() must have at least 1 active CPU Waiman Long
2026-11-16 3:07 ` Ridong Chen [this message]
2026-11-16 3:34 ` Waiman Long
2026-11-16 7:37 ` Ridong Chen
2026-11-16 1:23 ` [PATCH-next v4 3/6] cgroup/cpuset: Check remote partition underneath before making an invalid partition valid Waiman Long
2026-11-16 3:47 ` Ridong Chen
2026-11-16 4:21 ` Waiman Long
2026-11-16 1:23 ` [PATCH-next v4 4/6] cgroup/cpuset: Revert "remove global remote_children list" Waiman Long
2026-11-16 1:23 ` [PATCH-next v4 5/6] cgroup/cpuset: Handle remote partitions before local partitions in cpuset_handle_hotplug() Waiman Long
2026-11-16 7:08 ` Ridong Chen
2026-11-16 8:56 ` kernel test robot
2026-11-16 10:33 ` Guopeng Zhang
2026-11-16 1:23 ` [PATCH-next v4 6/6] cgroup/cpuset: Fix lockdep_is_cpuset_held() Waiman Long
2026-11-16 7:24 ` Ridong Chen
2026-11-17 4:06 ` Waiman Long
2026-11-16 10:34 ` 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=e437ac79-7999-43da-9fe8-6cfd475a5196@linux.dev \
--to=ridong.chen@linux.dev \
--cc=cgroups@vger.kernel.org \
--cc=guopeng.zhang@linux.dev \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mkoutny@suse.com \
--cc=sashiko-bot@kernel.org \
--cc=shuah@kernel.org \
--cc=tj@kernel.org \
/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.