All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH sched_ext/for-7.4-fixes] sched_ext: Fix partial-SMT core counting in calc_shard_layout()
@ 2026-11-06  2:44 Zhang Qiao
  2026-11-06 18:48 ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Qiao @ 2026-11-06  2:44 UTC (permalink / raw)
  To: sched-ext, Tejun Heo; +Cc: David Vernet, Andrea Righi, Changwoo Min, Hui Tang

A core is counted when its cpu is the first cpu of
topology_sibling_cpumask(), which includes offline cpus. When the
low-numbered siblings of a core are offline at root-enable time, no
online sibling passes the test and the core is not counted. The
resulting cores_per_shard and nr_large are then too small and the
cores are spread unevenly across shards.

Count a core when its cpu is the first sibling in @llc_cpus, matching
the cores the build loop actually constructs.

Fixes: e2c841b91bf9 ("sched_ext: Add CID sharding")
Signed-off-by: Zhang Qiao <zhangqiao22@huawei.com>
---
 kernel/sched/ext/cid.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/ext/cid.c b/kernel/sched/ext/cid.c
index 8e04a8494e11..64572e39c865 100644
--- a/kernel/sched/ext/cid.c
+++ b/kernel/sched/ext/cid.c
@@ -64,7 +64,9 @@ static void calc_shard_layout(const struct cpumask *llc_cpus,
u32 shard_size,
  	for_each_cpu(cpu, llc_cpus) {
 		nr_cpus++;
-		if (cpumask_first(topology_sibling_cpumask(cpu)) == cpu)
+		/* the low-numbered siblings may be offline */
+		if (cpumask_first_and(topology_sibling_cpumask(cpu),
+				      llc_cpus) == cpu)
 			nr_cores++;
 	}
 -- 2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-10  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06  2:44 [PATCH sched_ext/for-7.4-fixes] sched_ext: Fix partial-SMT core counting in calc_shard_layout() Zhang Qiao
2026-11-06 18:48 ` Tejun Heo
2026-11-10  6:28   ` Zhang Qiao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.