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

From: Ridong Chen

Date: Sat Nov 14 2026 - 03:32:13 EST


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 c66864faab32..3702e43e95ef 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1725,8 +1725,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;

@@ -1914,14 +1914,7 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
if (prstate_housekeeping_conflict(new_prs, PRS_ROOT, tmp->new_cpus, NULL))
return PERR_HKEEPING;

- 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.
*/
--
2.34.1