mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sashiko <sashiko-bot@kernel.org>,
	Ridong Chen <chenridong@xiaomi.com>
Subject: Re: [PATCH for-7.4-fixes] cgroup/cpuset: Remove redundant WARN_ON_ONCE() in remote_cpus_update()
Date: Sun, 15 Nov 2026 10:51:57 -0500	[thread overview]
Message-ID: <1f2a8f19-aecf-4c32-b6b2-36b0af6d0d06@redhat.com> (raw)
In-Reply-To: <20261114100612.1380464-1-ridong.chen@linux.dev>

On 11/14/26 5:06 AM, Ridong Chen wrote:
> From: Ridong Chen <chenridong@xiaomi.com>
>
> remote_cpus_update() warns if the CPUs to be added to a remote partition
> intersect subpartitions_cpus, and then checks the very same condition
> right below to set PERR_NOCPUS and invalidate the partition:
>
> 	WARN_ON_ONCE(cpumask_intersects(tmp->addmask, subpartitions_cpus));
> 	if (!capable(CAP_SYS_ADMIN))
> 		WRITE_ONCE(cs->prs_err, PERR_ACCESS);
> 	else if (cpumask_intersects(tmp->addmask, subpartitions_cpus) ||
> 		 cpumask_subset(top_cpuset.effective_cpus, tmp->addmask))
> 		WRITE_ONCE(cs->prs_err, PERR_NOCPUS);
>
> Sashiko reported that the warning could be triggered by a write to a
> cpuset control file, before the CAP_SYS_ADMIN check, which would panic a
> system with panic_on_warn set.
>
> The warning was added by commit 86888c7bd117 ("cgroup/cpuset: Add
> warnings to catch inconsistency in exclusive CPUs") as an assertion that
> such CPUs have been filtered out before. No way to trigger it with the
> current interfaces has been found, as these CPUs are rejected when
> cpuset.cpus.exclusive is written. But the warning is redundant, as the
> conflict is handled right below anyway.
>
> Remove the warning and rely on the PERR_NOCPUS check, the same as
> remote_partition_enable() already does for this conflict.
>
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Link: https://sashiko.dev/#/patchset/20261114083124.1340140-1-ridong.chen%40linux.dev?part=6
> Signed-off-by: Ridong Chen <chenridong@xiaomi.com>
> ---
>   kernel/cgroup/cpuset.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 7e374210c123..0be0d26c442b 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1833,7 +1833,6 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus,
>   	 * left in the top cpuset.
>   	 */
>   	if (adding) {
> -		WARN_ON_ONCE(cpumask_intersects(tmp->addmask, subpartitions_cpus));
>   		if (!capable(CAP_SYS_ADMIN))
>   			WRITE_ONCE(cs->prs_err, PERR_ACCESS);
>   		else if (cpumask_intersects(tmp->addmask, subpartitions_cpus) ||
>
> base-commit: e234ed1bb82c96a5643fd70784f16cf3d72eeed3
Reviewed-by: Waiman Long <longman@redhat.com>


      reply	other threads:[~2026-11-15 15:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 10:06 Ridong Chen
2026-11-15 15:51 ` Waiman Long [this message]

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=1f2a8f19-aecf-4c32-b6b2-36b0af6d0d06@redhat.com \
    --to=longman@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@xiaomi.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=ridong.chen@linux.dev \
    --cc=sashiko-bot@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

all inboxes | Powered by JetHome®