Skip to content

Commit 668e041

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup/cpuset: Fix incorrect isolated_cpus update in update_parent_effective_cpumask()
Before commit f0af1bf ("cgroup/cpuset: Relax constraints to partition & cpus changes"), a cpuset partition cannot be enabled if not all the requested CPUs can be granted from the parent cpuset. After that commit, a cpuset partition can be created even if the requested exclusive CPUs contain CPUs not allowed its parent. The delmask containing exclusive CPUs to be removed from its parent wasn't adjusted accordingly. That is not a problem until the introduction of a new isolated_cpus mask in commit 11e5f40 ("cgroup/cpuset: Keep track of CPUs in isolated partitions") as the CPUs in the delmask may be added directly into isolated_cpus. As a result, isolated_cpus may incorrectly contain CPUs that are not isolated leading to incorrect data reporting. Fix this by adjusting the delmask to reflect the actual exclusive CPUs for the creation of the partition. Fixes: 11e5f40 ("cgroup/cpuset: Keep track of CPUs in isolated partitions") Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 1e7857b commit 668e041

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/cgroup/cpuset.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,9 +1679,9 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
16791679
if (nocpu)
16801680
return PERR_NOCPUS;
16811681

1682-
cpumask_copy(tmp->delmask, xcpus);
1683-
deleting = true;
1684-
subparts_delta++;
1682+
deleting = cpumask_and(tmp->delmask, xcpus, parent->effective_xcpus);
1683+
if (deleting)
1684+
subparts_delta++;
16851685
new_prs = (cmd == partcmd_enable) ? PRS_ROOT : PRS_ISOLATED;
16861686
} else if (cmd == partcmd_disable) {
16871687
/*

0 commit comments

Comments
 (0)