From: Waiman Long <longman@redhat.com>
To: "Ridong Chen" <ridong.chen@linux.dev>,
"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>,
Waiman Long <longman@redhat.com>,
Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH-next v4 2/6] cgroup/cpuset: excpus parameter of remote_cpus_update() must have at least 1 active CPU
Date: Sun, 15 Nov 2026 20:23:05 -0500 [thread overview]
Message-ID: <20261116012330.2271010-3-longman@redhat.com> (raw)
In-Reply-To: <20261116012330.2271010-1-longman@redhat.com>
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;
}
--
2.56.0
next prev parent reply other threads:[~2026-11-16 1:23 UTC|newest]
Thread overview: 11+ 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 1:23 ` Waiman Long [this message]
2026-11-16 3:07 ` [PATCH-next v4 2/6] cgroup/cpuset: excpus parameter of remote_cpus_update() must have at least 1 active CPU Ridong Chen
2026-11-16 3:34 ` Waiman Long
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 1:23 ` [PATCH-next v4 6/6] cgroup/cpuset: Fix lockdep_is_cpuset_held() Waiman Long
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=20261116012330.2271010-3-longman@redhat.com \
--to=longman@redhat.com \
--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=mkoutny@suse.com \
--cc=ridong.chen@linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox