[RFC PATCH -v4 08/22] cpuset: use partition_disable() for remote partition disablement

From: Ridong Chen

Date: Sun Nov 01 2026 - 06:46:25 EST


From: Chen Ridong <chenridong@xxxxxxxxxx>

Now that the partition_disable() helper is available, replace the
existing implementation for remote partition disablement with this
centralized function to unify the disablement logic.

Signed-off-by: Chen Ridong <chenridong@xxxxxxxxxx>
Signed-off-by: Ridong Chen <chenridong@xxxxxxxxxx>
---
kernel/cgroup/cpuset.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index d7f9f6e1fa3c..9a683e6ef0be 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1915,6 +1915,8 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
*/
static void remote_partition_disable(struct cpuset *cs, struct tmpmasks *tmp)
{
+ int new_prs;
+
WARN_ON_ONCE(!is_remote_partition(cs));
/*
* When a CPU is offlined, top_cpuset may end up with no available CPUs,
@@ -1925,19 +1927,8 @@ static void remote_partition_disable(struct cpuset *cs, struct tmpmasks *tmp)
WARN_ON_ONCE(!cpumask_subset(cs->effective_xcpus, subpartitions_cpus) &&
!cpumask_empty(subpartitions_cpus));

- spin_lock_irq(&callback_lock);
- cs->remote_partition = false;
- partition_xcpus_del(cs->partition_root_state, NULL, cs->effective_xcpus);
- if (cs->prs_err)
- cs->partition_root_state = -cs->partition_root_state;
- else
- cs->partition_root_state = PRS_MEMBER;
-
- /* effective_xcpus may need to be changed */
- compute_excpus(cs, cs->effective_xcpus);
- reset_partition_data(cs);
- spin_unlock_irq(&callback_lock);
- cpuset_force_rebuild();
+ new_prs = cs->prs_err ? -cs->partition_root_state : PRS_MEMBER;
+ partition_disable(cs, NULL, new_prs, cs->prs_err);

/*
* Propagate changes in top_cpuset's effective_cpus down the hierarchy.
--
2.34.1