From: "Chuyi Zhou" <zhouchuyi@bytedance.com>
To: <longman@redhat.com>, <tj@kernel.org>, <hannes@cmpxchg.org>,
<mkoutny@suse.com>, <ridong.chen@linux.dev>
Cc: <linux-kernel@vger.kernel.org>, "Chuyi Zhou" <zhouchuyi@bytedance.com>
Subject: [PATCH 1/2] cgroup/cpuset: Skip v2 sibling checks with an empty exclusive CPU mask
Date: Wed, 2 Dec 2026 18:44:20 +0800 [thread overview]
Message-ID: <fc2977a8dab92954e1663a161ba6110178f50726.1796202058.git.zhouchuyi@bytedance.com> (raw)
In-Reply-To: <cover.1796202058.git.zhouchuyi@bytedance.com>
validate_change() skips the sibling walk on v2 only for members whose
exclusive CPU mask stays empty. It still scans siblings when a partition
root has no explicit exclusive CPUs or when a cpuset clears its mask.
An empty exclusive CPU mask can neither intersect a sibling's exclusive
CPUs nor contain a sibling's nonempty allowed CPU mask. Only the top
cpuset is memory-exclusive on v2, and it has no siblings.
Skip the walk whenever the trial exclusive CPU mask is empty. For a
partition root, compute_trialcs_excpus() still accounts for CPUs held
by siblings when computing the effective exclusive mask.
Suggested-by: Ridong Chen <ridong.chen@linux.dev>
Link: https://lore.kernel.org/r/825c0c94-8565-4c4c-82c7-9c0f5872e6a9@linux.dev
Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
---
kernel/cgroup/cpuset.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index fb6359d72b68..d2337f817568 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -805,14 +805,11 @@ int validate_change(struct cpuset *cur, struct cpuset *trial)
!cpuset_cpumask_can_shrink(cur->effective_cpus, user_xcpus(trial)))
goto out;
- xcpus_changed = !cpumask_equal(cur->exclusive_cpus, trial->exclusive_cpus);
-
/*
- * On v2 an unchanged, empty exclusive CPU mask cannot conflict with
+ * On v2 an empty exclusive CPU mask cannot conflict with
* a sibling's CPU masks. Only the top cpuset is memory-exclusive.
*/
- if (cpuset_v2() && cs_is_member(cur) && !xcpus_changed &&
- cpumask_empty(trial->exclusive_cpus))
+ if (cpuset_v2() && cpumask_empty(trial->exclusive_cpus))
goto valid;
/*
@@ -820,6 +817,7 @@ int validate_change(struct cpuset *cur, struct cpuset *trial)
* overlap. exclusive_cpus cannot overlap with each other if set.
*/
ret = -EINVAL;
+ xcpus_changed = !cpumask_equal(cur->exclusive_cpus, trial->exclusive_cpus);
cpuset_for_each_child(c, css, par) {
if (c == cur)
continue;
--
2.20.1
next prev parent reply other threads:[~2026-12-02 10:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 10:44 [PATCH 0/2] cgroup/cpuset: Limit v2 sibling checks to nonempty exclusive masks Chuyi Zhou
2026-12-02 10:44 ` Chuyi Zhou [this message]
2026-12-02 10:44 ` [PATCH 2/2] cgroup/cpuset: Separate v1 and v2 sibling exclusivity checks Chuyi Zhou
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=fc2977a8dab92954e1663a161ba6110178f50726.1796202058.git.zhouchuyi@bytedance.com \
--to=zhouchuyi@bytedance.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mkoutny@suse.com \
--cc=ridong.chen@linux.dev \
--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
all inboxes | Powered by JetHome®