mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable.git
synced 2025-09-13 11:07:46 +10:00
cgroup/cpuset: Fix a partition error with CPU hotplug
[ Upstream commit150e298ae0
] It was found during testing that an invalid leaf partition with an empty effective exclusive CPU list can become a valid empty partition with no CPU afer an offline/online operation of an unrelated CPU. An empty partition root is allowed in the special case that it has no task in its cgroup and has distributed out all its CPUs to its child partitions. That is certainly not the case here. The problem is in the cpumask_subsets() test in the hotplug case (update with no new mask) of update_parent_effective_cpumask() as it also returns true if the effective exclusive CPU list is empty. Fix that by addding the cpumask_empty() test to root out this exception case. Also add the cpumask_empty() test in cpuset_hotplug_update_tasks() to avoid calling update_parent_effective_cpumask() for this special case. Fixes:0c7f293efc
("cgroup/cpuset: Add cpuset.cpus.exclusive.effective for v2") Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
68da1fac48
commit
7a60c21384
@ -1771,7 +1771,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
|
||||
if (is_partition_valid(cs))
|
||||
adding = cpumask_and(tmp->addmask,
|
||||
xcpus, parent->effective_xcpus);
|
||||
} else if (is_partition_invalid(cs) &&
|
||||
} else if (is_partition_invalid(cs) && !cpumask_empty(xcpus) &&
|
||||
cpumask_subset(xcpus, parent->effective_xcpus)) {
|
||||
struct cgroup_subsys_state *css;
|
||||
struct cpuset *child;
|
||||
@ -3792,9 +3792,10 @@ retry:
|
||||
partcmd = partcmd_invalidate;
|
||||
/*
|
||||
* On the other hand, an invalid partition root may be transitioned
|
||||
* back to a regular one.
|
||||
* back to a regular one with a non-empty effective xcpus.
|
||||
*/
|
||||
else if (is_partition_valid(parent) && is_partition_invalid(cs))
|
||||
else if (is_partition_valid(parent) && is_partition_invalid(cs) &&
|
||||
!cpumask_empty(cs->effective_xcpus))
|
||||
partcmd = partcmd_update;
|
||||
|
||||
if (partcmd >= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user