From: Ridong Chen <ridong.chen@linux.dev>
To: Hui Peng <benquike@gmail.com>,
longman@redhat.com, tj@kernel.org, hannes@cmpxchg.org,
mkoutny@suse.com
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cgroup/cpuset: prevent overlapping local and remote partition creation
Date: Sun, 20 Sep 2026 09:22:09 +0800 [thread overview]
Message-ID: <139d9231-4723-4365-9af7-8142e6581ede@linux.dev> (raw)
In-Reply-To: <20260919221727.3706964-1-benquike@gmail.com>
On 9/20/2026 6:17 AM, Hui Peng wrote:
> Fix two partition validation bugs in kernel/cgroup/cpuset.c:
>
> 1. In remote_partition_enable(), check whether the requested effective
> xcpus intersect parent->subpartitions_cpus so a remote partition
> cannot claim CPUs already delegated to a local child partition.
> 2. In validate_partition(), verify that enabling a local partition does
> not overlap CPUs already allocated to an active remote partition.
>
> Fixes: aa7d3a56a20f ("cpuset: fix warning when disabling remote partition")
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@gmail.com>
Could you please first describe what the issue is and how it can be triggered?
Or is there any reproducer?
> ---
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 2538faac9aba..13fad096c494 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -713,7 +713,10 @@ static inline bool cpus_excl_conflict(struct cpuset *trial, struct cpuset *sibli
> return true;
>
> /* Exclusive_cpus cannot intersect */
> - return cpumask_intersects(trial->exclusive_cpus, sibling->exclusive_cpus);
> + return cpumask_intersects(trial->exclusive_cpus,
> + cpumask_empty(sibling->exclusive_cpus)
> + ? sibling->effective_xcpus
> + : sibling->exclusive_cpus);
> }
>
> static inline bool mems_excl_conflict(struct cpuset *cs1, struct cpuset *cs2)
> @@ -1591,8 +1594,8 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
> * above it or remote partition root underneath it is not allowed.
> */
> compute_excpus(cs, tmp->new_cpus);
> - WARN_ON_ONCE(cpumask_intersects(tmp->new_cpus, subpartitions_cpus));
> if (!cpumask_intersects(tmp->new_cpus, cpu_active_mask) ||
> + cpumask_intersects(tmp->new_cpus, subpartitions_cpus) ||
> cpumask_subset(top_cpuset.effective_cpus, tmp->new_cpus))
> return PERR_INVCPUS;
> if (((new_prs == PRS_ISOLATED) &&
> @@ -2411,6 +2414,10 @@ static enum prs_errcode validate_partition(struct cpuset *cs, struct cpuset *tri
> if (cpumask_empty(trialcs->effective_xcpus))
> return PERR_INVCPUS;
>
> + if ((parent == &top_cpuset) &&
> + cpumask_intersects(trialcs->effective_xcpus, subpartitions_cpus))
> + return PERR_REMOTE;
> +
> if (prstate_housekeeping_conflict(trialcs->partition_root_state,
> trialcs->effective_xcpus))
> return PERR_HKEEPING;
> @@ -2970,7 +2977,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
> * local or remote partition.
> */
> if ((parent == &top_cpuset) &&
> - cpumask_intersects(cs->exclusive_cpus, subpartitions_cpus)) {
> + cpumask_intersects(user_xcpus(cs), subpartitions_cpus)) {
> err = PERR_REMOTE;
> goto out;
> }
--
Best regards
Ridong
next prev parent reply other threads:[~2026-09-20 1:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 22:17 Hui Peng
2026-09-20 1:22 ` Ridong Chen [this message]
2026-09-20 3:04 ` Hui Peng
2026-09-20 8:23 ` [PATCH v2 1/2] cgroup/cpuset: return PERR_NOCPUS in remote_partition_enable() on subpartitions_cpus conflict Hui Peng
2026-09-20 8:23 ` [PATCH v2 2/2] cgroup/cpuset: prevent local partition activation over remote partition and sibling xcpus conflict Hui Peng
2026-09-20 8:57 ` Guopeng Zhang
2026-09-20 6:30 ` [PATCH] cgroup/cpuset: prevent overlapping local and remote partition creation Guopeng Zhang
2026-09-20 8:23 ` Hui Peng
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=139d9231-4723-4365-9af7-8142e6581ede@linux.dev \
--to=ridong.chen@linux.dev \
--cc=benquike@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mkoutny@suse.com \
--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®