aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorWaiman Long <longman@redhat.com>2024-08-04 21:30:18 -0400
committerTejun Heo <tj@kernel.org>2024-08-05 10:57:38 -1000
commit99570300d3b4c8a1463491754d58e7a8d87cacef (patch)
tree0e6f43298218819a3311838d95fe7d6d9b1c58c9
parentMerge branch 'cgroup/for-6.11-fixes' into cgroup/for-6.12 (diff)
downloadwireguard-linux-99570300d3b4c8a1463491754d58e7a8d87cacef.tar.xz
wireguard-linux-99570300d3b4c8a1463491754d58e7a8d87cacef.zip
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>
-rw-r--r--kernel/cgroup/cpuset.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index e070e391d7a8..e34fd6108b06 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1127,25 +1127,27 @@ v2:
if (root_load_balance && (csn == 1))
goto single_root_domain;
- if (!cgrpv2) {
- for (i = 0; i < csn; i++)
- uf_node_init(&csa[i]->node);
-
- /* Merge overlapping cpusets */
- for (i = 0; i < csn; i++) {
- for (j = i + 1; j < csn; j++) {
- if (cpusets_overlap(csa[i], csa[j]))
- uf_union(&csa[i]->node, &csa[j]->node);
+ for (i = 0; i < csn; i++)
+ uf_node_init(&csa[i]->node);
+
+ /* Merge overlapping cpusets */
+ for (i = 0; i < csn; i++) {
+ for (j = i + 1; j < csn; j++) {
+ if (cpusets_overlap(csa[i], csa[j])) {
+ /*
+ * 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 */
- for (i = 0; i < csn; i++) {
- if (uf_find(&csa[i]->node) == &csa[i]->node)
- ndoms++;
- }
- } else {
- ndoms = csn;
+ /* Count the total number of domains */
+ for (i = 0; i < csn; i++) {
+ if (uf_find(&csa[i]->node) == &csa[i]->node)
+ ndoms++;
}
/*