cgroup/cpuset: Check for partition roots with overlapping CPUs
With the previous commit that eliminates the overlapping partition root corner cases in the hotplug code, the partition roots passed down to generate_sched_domains() should not have overlapping CPUs. Enable overlapping cpuset check for v2 and warn if that happens. This patch also has the benefit of increasing test coverage of the new Union-Find cpuset merging code to cgroup v2. Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
bc3c27516f
commit
99570300d3
@ -1127,25 +1127,27 @@ v2:
|
|||||||
if (root_load_balance && (csn == 1))
|
if (root_load_balance && (csn == 1))
|
||||||
goto single_root_domain;
|
goto single_root_domain;
|
||||||
|
|
||||||
if (!cgrpv2) {
|
for (i = 0; i < csn; i++)
|
||||||
for (i = 0; i < csn; i++)
|
uf_node_init(&csa[i]->node);
|
||||||
uf_node_init(&csa[i]->node);
|
|
||||||
|
|
||||||
/* Merge overlapping cpusets */
|
/* Merge overlapping cpusets */
|
||||||
for (i = 0; i < csn; i++) {
|
for (i = 0; i < csn; i++) {
|
||||||
for (j = i + 1; j < csn; j++) {
|
for (j = i + 1; j < csn; j++) {
|
||||||
if (cpusets_overlap(csa[i], csa[j]))
|
if (cpusets_overlap(csa[i], csa[j])) {
|
||||||
uf_union(&csa[i]->node, &csa[j]->node);
|
/*
|
||||||
|
* Cgroup v2 shouldn't pass down overlapping
|
||||||
|
* partition root cpusets.
|
||||||
|
*/
|
||||||
|
WARN_ON_ONCE(cgrpv2);
|
||||||
|
uf_union(&csa[i]->node, &csa[j]->node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Count the total number of domains */
|
/* Count the total number of domains */
|
||||||
for (i = 0; i < csn; i++) {
|
for (i = 0; i < csn; i++) {
|
||||||
if (uf_find(&csa[i]->node) == &csa[i]->node)
|
if (uf_find(&csa[i]->node) == &csa[i]->node)
|
||||||
ndoms++;
|
ndoms++;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ndoms = csn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user