mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ridong Chen <ridong.chen@linux.dev>
To: Chuyi Zhou <zhouchuyi@bytedance.com>,
	longman@redhat.com, tj@kernel.org, hannes@cmpxchg.org,
	mkoutny@suse.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] cgroup/cpuset: Skip v2 sibling checks with an empty exclusive CPU mask
Date: Thu, 3 Dec 2026 20:54:14 +0800	[thread overview]
Message-ID: <d762fc19-1aad-4100-894a-bd7b42c49109@linux.dev> (raw)
In-Reply-To: <fc2977a8dab92954e1663a161ba6110178f50726.1796202058.git.zhouchuyi@bytedance.com>



On 12/2/2026 6:44 PM, Chuyi Zhou wrote:
> 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;

Hi Chuyi,

Thank you for patches.

I don't think this should be a separate patch. I know Tejun has
already accepted patch 4 of your previous series, but if he can
update or drop it, a cleaner way would be to do patch 2 of this
series first, and then filter out the cpumask_empty(trial->exclusive_cpus)
case on top of it. That would make the changes easier to follow.

-- 
Best regards
Ridong


  reply	other threads:[~2026-12-03 12:54 UTC|newest]

Thread overview: 5+ 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 ` [PATCH 1/2] cgroup/cpuset: Skip v2 sibling checks with an empty exclusive CPU mask Chuyi Zhou
2026-12-03 12:54   ` Ridong Chen [this message]
2026-12-03 12:59     ` Chuyi Zhou
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=d762fc19-1aad-4100-894a-bd7b42c49109@linux.dev \
    --to=ridong.chen@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=tj@kernel.org \
    --cc=zhouchuyi@bytedance.com \
    /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®