Skip to content

Commit b62a030

Browse files
committed
LoongArch: Correct the cacheinfo sharing information
SMT cores and their sibling cores share the same L1 and L2 private caches (of course last level cache is also shared), so correct the cacheinfo sharing information to let shared_cpu_map correctly reflect this relationship. Below is the output of "lscpu" on Loongson-3A6000 (4 cores, 8 threads). 1. Before patch: L1d: 512 KiB (8 instances) L1i: 512 KiB (8 instances) L2: 2 MiB (8 instances) L3: 16 MiB (1 instance) 2. After patch: L1d: 256 KiB (4 instances) L1i: 256 KiB (4 instances) L2: 1 MiB (4 instances) L3: 16 MiB (1 instance) Reported-by: Chao Li <[email protected]> Signed-off-by: Juxin Gao <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 98e720f commit b62a030

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/loongarch/kernel/cacheinfo.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ static void cache_cpumap_setup(unsigned int cpu)
5151
continue;
5252

5353
sib_leaf = sib_cpu_ci->info_list + index;
54+
/* SMT cores share all caches */
55+
if (cpus_are_siblings(i, cpu)) {
56+
cpumask_set_cpu(cpu, &sib_leaf->shared_cpu_map);
57+
cpumask_set_cpu(i, &this_leaf->shared_cpu_map);
58+
}
59+
/* Node's cores share shared caches */
5460
if (cache_leaves_are_shared(this_leaf, sib_leaf)) {
5561
cpumask_set_cpu(cpu, &sib_leaf->shared_cpu_map);
5662
cpumask_set_cpu(i, &this_leaf->shared_cpu_map);

0 commit comments

Comments
 (0)