[PATCH v5 09/12] cpuset: use partition_disable() for local partition disablement
From: Ridong Chen
Date: Sat Nov 14 2026 - 03:32:45 EST
From: Ridong Chen <chenridong@xxxxxxxxxx>
Replace the partcmd_disable handling of update_parent_effective_cpumask()
with partition_disable(), the same as for remote partition disablement.
partition_disable() gives the CPUs of a valid partition back to its
parent and propagates the change of the parent's effective_cpus to
the tasks and the other children of the parent.
An invalid partition has already given back its CPUs, so
update_prstate() only calls partition_disable() for a valid partition
and keeps setting the state of an invalid one itself.
Signed-off-by: Ridong Chen <chenridong@xxxxxxxxxx>
---
kernel/cgroup/cpuset.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 45605c6ab6a2..211567c61e95 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2182,18 +2182,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
nocpu = tasks_nocpu_error(parent, cs, tmp->delmask);
}
- if (cmd == partcmd_disable) {
- /*
- * May need to add cpus back to parent's effective_cpus
- * (and maybe removed from subpartitions_cpus/isolated_cpus)
- * for valid partition root.
- */
- if (is_partition_valid(cs)) {
- cpumask_copy(tmp->addmask, cs->effective_xcpus);
- adding = true;
- }
- new_prs = PRS_MEMBER;
- } else if (newmask) {
+ if (newmask) {
/*
* Empty cpumask is not allowed
*/
@@ -3225,12 +3214,8 @@ static int update_prstate(struct cpuset *cs, int new_prs)
}
if (disable_partition) {
- if (is_remote_partition(cs))
+ if (is_partition_valid(cs))
partition_disable(cs, PRS_MEMBER, PERR_NONE, &tmpmask);
- else
- update_parent_effective_cpumask(cs, partcmd_disable,
- NULL, &tmpmask);
-
/*
* Invalidation of child partitions will be done in
* update_cpumasks_hier() below.
--
2.34.1