Re: [PATCH v6 04/12] cpuset: use partition_enable() for remote partition enablement

From: Guopeng Zhang

Date: Fri Dec 04 2026 - 23:21:25 EST




在 2026/11/29 10:44, Ridong Chen 写道:
> From: Ridong Chen <chenridong@xxxxxxxxxx>
>
> Now that the partition_enable() helper is available, replace the
> existing implementation for remote partition enablement with this
> centralized function to unify the enablement logic.
>
> As partition_enable() also sends the partition change notification,
> update_prstate() may notify again at its end. cgroup_file_notify()
> rate-limits the notifications, and the one in update_prstate() will be
> removed later.
>
> Signed-off-by: Ridong Chen <chenridong@xxxxxxxxxx>
> ---
> kernel/cgroup/cpuset.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 7efec768f212..895e8aa455c1 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1731,8 +1731,8 @@ static void partition_state_update(struct cpuset *cs, int new_prs,
> * Transitions a cpuset to a partition root, only for v2.
> * It also supports the transition between root and isolated partition.
> */
> -static void __maybe_unused partition_enable(struct cpuset *cs, struct cpuset *parent,
> - int new_prs, struct cpumask *new_excpus)
> +static void partition_enable(struct cpuset *cs, struct cpuset *parent,
> + int new_prs, struct cpumask *new_excpus)
> {
> int old_prs = cs->partition_root_state;
>
> @@ -1919,14 +1919,7 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
> if (err)
> return err;
>
> - spin_lock_irq(&callback_lock);
> - partition_xcpus_add(new_prs, NULL, tmp->new_cpus);
> - cs->remote_partition = true;
> - cpumask_copy(cs->effective_xcpus, tmp->new_cpus);
> - spin_unlock_irq(&callback_lock);
> - cpuset_force_rebuild();
> - WRITE_ONCE(cs->prs_err, 0);
> -
> + partition_enable(cs, NULL, new_prs, tmp->new_cpus);
> /*
> * Propagate changes in top_cpuset's effective_cpus down the hierarchy.
> */

Reviewed-by: Guopeng Zhang <zhangguopeng@xxxxxxxxxx>

Thanks,
Guopeng