On 2026/2/13 0:46, Waiman Long wrote:
> The effective_xcpus of a cpuset can contain offline CPUs. In
> partition_xcpus_del(), the xcpus parameter is incorrectly used as
> a temporary cpumask to mask out offline CPUs. As xcpus can be the
> effective_xcpus of a cpuset, this can result in unexpected changes
> in that cpumask. Fix this problem by not making any changes to the
> xcpus parameter.
>
> Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated
> partitions")
> Signed-off-by: Waiman Long <[email protected]>
> ---
> kernel/cgroup/cpuset.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index c43efef7df71..a366ef84f982 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1221,8 +1221,8 @@ static void partition_xcpus_del(int old_prs, struct
> cpuset *parent,
> isolated_cpus_update(old_prs, parent->partition_root_state,
> xcpus);
>
> - cpumask_and(xcpus, xcpus, cpu_active_mask);
> cpumask_or(parent->effective_cpus, parent->effective_cpus, xcpus);
> + cpumask_and(parent->effective_cpus, parent->effective_cpus,
> cpu_active_mask);
> }
>
> /*
The final content of parent->effective_cpus remains unchanged, and the fix
looks correct to me.
Reviewed-by: Chen Ridong <[email protected]>
--
Best regards,
Ridong