Re: [PATCH v2 3/4] cgroup/cpuset: Drop cpusets_overlap()

From: Ridong Chen

Date: Mon Nov 30 2026 - 20:24:20 EST




On 11/30/2026 8:04 PM, Chuyi Zhou wrote:
cpuset1_generate_sched_domains() is the only caller of cpusets_overlap().
Call cpumask_intersects() directly on the two effective CPU masks and
remove the wrapper from the shared cpuset header.

Suggested-by: Ridong Chen <ridong.chen@xxxxxxxxx>
Signed-off-by: Chuyi Zhou <zhouchuyi@xxxxxxxxxxxxx>
---
kernel/cgroup/cpuset-internal.h | 9 ---------
kernel/cgroup/cpuset-v1.c | 3 ++-
2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/kernel/cgroup/cpuset-internal.h b/kernel/cgroup/cpuset-internal.h
index 5c80f2798825..b1c8f8fc2edf 100644
--- a/kernel/cgroup/cpuset-internal.h
+++ b/kernel/cgroup/cpuset-internal.h
@@ -257,15 +257,6 @@ static inline int is_spread_slab(const struct cpuset *cs)
return test_bit(CS_SPREAD_SLAB, &cs->flags);
}
-/*
- * Helper routine for cpuset1_generate_sched_domains().
- * Do cpusets a, b have overlapping effective cpus_allowed masks?
- */
-static inline int cpusets_overlap(struct cpuset *a, struct cpuset *b)
-{
- return cpumask_intersects(a->effective_cpus, b->effective_cpus);
-}
-
static inline int nr_cpusets(void)
{
/* jump label reference count + the top-level cpuset */
diff --git a/kernel/cgroup/cpuset-v1.c b/kernel/cgroup/cpuset-v1.c
index 7c7f2887dfaf..e64bbf181faf 100644
--- a/kernel/cgroup/cpuset-v1.c
+++ b/kernel/cgroup/cpuset-v1.c
@@ -756,7 +756,8 @@ int cpuset1_generate_sched_domains(cpumask_var_t **domains,
/* Merge overlapping cpusets */
for (i = 0; i < csn; i++) {
for (j = i + 1; j < csn; j++) {
- if (cpusets_overlap(csa[i], csa[j]))
+ if (cpumask_intersects(csa[i]->effective_cpus,
+ csa[j]->effective_cpus))
uf_union(&csa[i]->node, &csa[j]->node);
}
}

Reviewed-by: Ridong Chen <ridong.chen@xxxxxxxxx>
Thanks.

--
Best regards
Ridong