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>
Subject: [PATCH v2 2/3] cgroup/cpuset: Recompute effective cpumask in update_cpumasks_hier() after calling update_parent_effective_cpumask()
Date: Fri, 30 Oct 2026 15:07:00 -0400 [thread overview]
Message-ID: <20261030190701.78308-3-longman@redhat.com> (raw)
In-Reply-To: <20261030190701.78308-1-longman@redhat.com>
It is reported by sashiko that calling update_parent_effective_cpumask()
may clobber tmp->new_cpus when update_sibling_cpumasks() needs to be
called due to possible change in the parent's effective_cpus value.
Therefore the new effective cpumask has to be recomputed after calling
update_parent_effective_cpumask() to get a correct value back into
tmp->new_cpus.
Fixes: f0af1bfc27b5 ("cgroup/cpuset: Relax constraints to partition & cpus changes")
Signed-off-by: Waiman Long <longman@redhat.com>
---
kernel/cgroup/cpuset.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 39c81a0a8ab9..ed014ecb770c 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2359,12 +2359,12 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp,
update_parent_effective_cpumask(cp, partcmd_update, NULL, tmp);
/*
* Capture current partition_root_state as it may have
- * changed. Recompute effective cpumask if changed.
+ * changed. Always recompute effective cpumask as tmp->new_cpus
+ * may be clobbered when update_sibling_cpumasks() is called
+ * within update_parent_effective_cpumask().
*/
new_prs = cp->partition_root_state;
- if (new_prs != old_prs) {
- compute_effective_cpumask(tmp->new_cpus, cp, parent);
- }
+ compute_effective_cpumask(tmp->new_cpus, cp, parent);
}
spin_lock_irq(&callback_lock);
--
2.56.0
next prev parent reply other threads:[~2026-10-30 19:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 19:06 [PATCH v2 0/3] cgroup/cpuset: Fix some more bugs in cpuset partition code Waiman Long
2026-10-30 19:06 ` [PATCH v2 1/3] cgroup/cpuset: Fix incorrect CPU accounting with parent's effective_xcpus expansion Waiman Long
2026-10-30 19:07 ` Waiman Long [this message]
2026-10-30 19:07 ` [PATCH v2 3/3] cgroup/cpuset: Do housekeeping check when isolated child with root parent may get more xcpus 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=20261030190701.78308-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=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