From: Guopeng Zhang <guopeng.zhang@linux.dev>
To: "Ridong Chen" <ridong.chen@linux.dev>,
"Waiman Long" <longman@redhat.com>, "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,
Ridong Chen <chenridong@xiaomi.com>
Subject: Re: [PATCH v6 06/12] cpuset: use partition_update() for remote partition update
Date: Sat, 5 Dec 2026 12:50:47 +0800 [thread overview]
Message-ID: <e822f793-72d8-457e-9df7-8cd2a21ead9b@linux.dev> (raw)
In-Reply-To: <20261129024431.2485721-7-ridong.chen@linux.dev>
在 2026/11/29 10:44, Ridong Chen 写道:
> From: Ridong Chen <chenridong@xiaomi.com>
>
> Now that the partition_update() helper is available, use it to replace
> the existing remote partition update logic. This unifies the update
> path through a single centralized function.
>
> Signed-off-by: Ridong Chen <chenridong@xiaomi.com>
> ---
> kernel/cgroup/cpuset.c | 28 ++++++----------------------
> 1 file changed, 6 insertions(+), 22 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index f31512de9667..39d5b56f14b0 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1837,8 +1837,8 @@ static void partition_disable(struct cpuset *cs, int new_prs,
> * partition, and the CPUs in tmp->delmask are given back to it. If that
> * parent is top_cpuset, subpartitions_cpus is updated accordingly.
> */
> -static void __maybe_unused partition_update(struct cpuset *cs, int prs, struct cpumask *xcpus,
> - struct cpumask *excpus, struct tmpmasks *tmp)
> +static void partition_update(struct cpuset *cs, int prs, struct cpumask *xcpus,
> + struct cpumask *excpus, struct tmpmasks *tmp)
> {
> struct cpuset *parent;
>
> @@ -1940,7 +1940,6 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
> static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus,
> struct cpumask *excpus, struct tmpmasks *tmp)
> {
> - bool adding, deleting;
> int prs = cs->partition_root_state;
>
> if (WARN_ON_ONCE(!is_remote_partition(cs)))
> @@ -1953,15 +1952,15 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus,
> goto invalidate;
> }
>
> - adding = cpumask_andnot(tmp->addmask, excpus, cs->effective_xcpus);
> - deleting = cpumask_andnot(tmp->delmask, cs->effective_xcpus, excpus);
> + cpumask_andnot(tmp->addmask, excpus, cs->effective_xcpus);
> + cpumask_andnot(tmp->delmask, cs->effective_xcpus, excpus);
>
> /*
> * Additions of remote CPUs is only allowed if those CPUs are
> * not allocated to other partitions and there are effective_cpus
> * left in the top cpuset.
> */
> - if (adding) {
> + if (!cpumask_empty(tmp->addmask)) {
> enum prs_errcode err = prstate_housekeeping_conflict(prs, PRS_ROOT,
> excpus, tmp->delmask);
>
> @@ -1977,22 +1976,7 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus,
> }
>
> cs->remote_partition_updating = true;
> - spin_lock_irq(&callback_lock);
> - if (adding)
> - partition_xcpus_add(prs, NULL, tmp->addmask);
> - if (deleting)
> - partition_xcpus_del(prs, NULL, tmp->delmask);
> - /*
> - * Need to update effective_xcpus and exclusive_cpus now as
> - * update_sibling_cpumasks() below may iterate back to the same cs.
> - */
> - cpumask_copy(cs->effective_xcpus, excpus);
> - if (xcpus)
> - cpumask_copy(cs->exclusive_cpus, xcpus);
> - spin_unlock_irq(&callback_lock);
> - if (adding || deleting)
> - cpuset_force_rebuild();
> -
> + partition_update(cs, prs, xcpus, excpus, tmp);
> /*
> * Propagate changes in top_cpuset's effective_cpus down the hierarchy.
> */
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Thanks,
Guopeng
next prev parent reply other threads:[~2026-12-05 4:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 2:44 [PATCH v6 00/12] cpuset: rework local partition logic Ridong Chen
2026-11-29 2:44 ` [PATCH v6 01/12] cpuset: introduce partition_enable() Ridong Chen
2026-12-05 4:20 ` Guopeng Zhang
2026-11-29 2:44 ` [PATCH v6 02/12] cpuset: introduce partition_disable() Ridong Chen
2026-12-05 4:20 ` Guopeng Zhang
2026-11-29 2:44 ` [PATCH v6 03/12] cpuset: introduce partition_update() Ridong Chen
2026-12-05 4:20 ` Guopeng Zhang
2026-11-29 2:44 ` [PATCH v6 04/12] cpuset: use partition_enable() for remote partition enablement Ridong Chen
2026-12-05 4:21 ` Guopeng Zhang
2026-11-29 2:44 ` [PATCH v6 05/12] cpuset: use partition_disable() for remote partition disablement Ridong Chen
2026-12-01 3:16 ` Waiman Long
2026-12-01 12:16 ` Ridong Chen
2026-11-29 2:44 ` [PATCH v6 06/12] cpuset: use partition_update() for remote partition update Ridong Chen
2026-12-05 4:50 ` Guopeng Zhang [this message]
2026-11-29 2:44 ` [PATCH v6 07/12] cpuset: introduce validate_local_partition() Ridong Chen
2026-11-29 2:44 ` [PATCH v6 08/12] cpuset: introduce local_partition_enable() Ridong Chen
2026-11-29 2:44 ` [PATCH v6 09/12] cpuset: use partition_disable() for local partition disablement Ridong Chen
2026-11-29 2:44 ` [PATCH v6 10/12] cpuset: use partition_disable() to invalidate local partition Ridong Chen
2026-11-29 2:44 ` [PATCH v6 11/12] cpuset: introduce local_partition_update() Ridong Chen
2026-11-29 2:44 ` [PATCH v6 12/12] cpuset: remove update_parent_effective_cpumask Ridong Chen
2026-12-04 3:49 ` [PATCH v6 00/12] cpuset: rework local partition logic Ridong Chen
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=e822f793-72d8-457e-9df7-8cd2a21ead9b@linux.dev \
--to=guopeng.zhang@linux.dev \
--cc=cgroups@vger.kernel.org \
--cc=chenridong@xiaomi.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