Re: [PATCH v6 09/12] cpuset: use partition_disable() for local partition disablement
From: Guopeng Zhang
Date: Sat Dec 05 2026 - 02:53:17 EST
在 2026/11/29 10:44, Ridong Chen 写道:
> 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 ea5fcf583444..e226d89004fe 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -2188,18 +2188,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
> */
> @@ -3220,12 +3209,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.
Reviewed-by: Guopeng Zhang <zhangguopeng@xxxxxxxxxx>
Thanks,
Guopeng