Re: [PATCH v3 04/21] sched/cache: Make LLC id continuous
From: Chen, Yu C
Date: Wed Feb 18 2026 - 10:11:53 EST
On 2/17/2026 4:09 PM, K Prateek Nayak wrote:
Hello Chenyu,
On 2/17/2026 11:37 AM, Chen, Yu C wrote:
Hi Prateek,
On 2/16/2026 3:44 PM, K Prateek Nayak wrote:
Hello Tim, Chenyu,
On 2/11/2026 3:48 AM, Tim Chen wrote:
From: Chen Yu <yu.c.chen@xxxxxxxxx>
[...]
@@ -2567,10 +2567,18 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
/* Set up domains for CPUs specified by the cpu_map: */
for_each_cpu(i, cpu_map) {
- struct sched_domain_topology_level *tl;
+ struct sched_domain_topology_level *tl, *tl_llc = NULL;
+ int lid;
sd = NULL;
for_each_sd_topology(tl) {
+ int flags = 0;
+
+ if (tl->sd_flags)
+ flags = (*tl->sd_flags)();
+
+ if (flags & SD_SHARE_LLC)
+ tl_llc = tl;
nit. This loop breaks out when sched_domain_span(sd) covers the entire
cpu_map and it might have not reached the topmost SD_SHARE_LLC domain
yet. Is that cause for any concern?
Could you please elaborate a little more on this? If it covers the
entire cpu_map shouldn't it stop going up to its parent domain?
Do you mean, sd_llc_1 and its parent sd_llc_2 could cover the same cpu_map,
and we should let tl_llc to assigned to sd_llc_2 (sd_llc_1 be degenerated? )
I'm not sure if this is technically possible but assume following
topology:
[ LLC: 8-15 ]
[ SMT: 8,9 ][ SMT: 10,11 ] ... [ SMT: 14,15 ]
and the following series of events:
o All CPUs in LLC are offline to begin with (maxcpus = 1 like scenario).
o CPUs 10-15 are onlined first.
o CPU8 is put in a separate root partition and brought online.
(XXX: I'm not 100% sure if this is possible in this order)
It can happen, I had a try on VM, and there would be different
llc_id within 1 LLC even after CPU8 has been taken out of the separate
partition.
o build_sched_domains() will bail out at SMT domain since the cpumap
is covered by tl->mask() and tl_llc = tl_smt.
o llc_id calculation uses the tl_smt->mask() which will not contain
CPUs 10-15 and CPU8 will get a unique LLC id even though there are
other online CPUs in the LLC with a different llc_id (!!!)
Fair enough, thanks for the explanation in detail.
thanks,
Chenyu