Re: [PATCH -next RFC 11/16] cpuset: simplify partition update logic for hotplug tasks

From: Waiman Long

Date: Sun Oct 19 2025 - 23:00:22 EST



On 9/28/25 3:13 AM, Chen Ridong wrote:
From: Chen Ridong <chenridong@xxxxxxxxxx>

Simplify the partition update logic in cpuset_hotplug_update_tasks() by
calling the unified local_partition_update() interface.

For local partitions, the previous patch introduced local_partition_update
which handles both validation state transitions:
- Invalidates local partitions that fail validation checks
- Transitions invalid partitions to valid state when no errors are detected

This eliminates the need for separate transition logic
in cpuset_hotplug_update_tasks(), which can now simply call
local_partition_update() to handle all local partition changes.

This patch simplifies the logic by always proceeding to update_tasks for
remote partitions, regardless of whether they were disabled or not. Since
the original code didn't perform any meaningful operations for non-disabled
remote partitions, this change should not affect functionality.

The partition_cmd mechanism can now be safely removed as it is no longer

It is partition_cmd enum type.

referenced by any code paths after the partition update logic
simplification.

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

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 9e98df542715..a1896a199c8b 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1211,17 +1211,6 @@ static void compute_effective_cpumask(struct cpumask *new_cpus,
cpumask_and(new_cpus, cs->cpus_allowed, parent->effective_cpus);
}
-/*
- * Commands for update_parent_effective_cpumask
- */
-enum partition_cmd {
- partcmd_enable, /* Enable partition root */
- partcmd_enablei, /* Enable isolated partition root */
- partcmd_disable, /* Disable partition root */
- partcmd_update, /* Update parent's effective_cpus */
- partcmd_invalidate, /* Make partition invalid */
-};
-
static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
struct tmpmasks *tmp);
@@ -2062,6 +2051,9 @@ static int __local_partition_update(struct cpuset *cs, struct cpumask *xcpus,
update_partition_sd_lb(cs, old_prs);
return part_error;
}
+ /* Nothing changes, return PERR_NONE */
+ if (new_prs == old_prs && cpumask_equal(excpus, cs->effective_xcpus))
+ return PERR_NONE;
I believe you already have this check added when you introduce __local_partition_update() in patch 9. It is a duplicate.

Cheers,
Longman