Le 26/08/2025 à 06:13, K Prateek Nayak a écrit :
Unify the tl_smt_mask() wrapper around cpu_smt_mask() across core, x86,
ppc, and s390.
On s390, include/linux/topology.c defines an explicit cpu_smt_mask()
wrapper around topology_sibling_cpumask() when cpu_smt_mask() is not
defined by the arch/ bits and topology_sibling_cpumask() on s390 returns
&cpu_topology[cpu].thread_mask.
No functional changes intended.
Signed-off-by: K Prateek Nayak <kprateek.na...@amd.com>
---
arch/powerpc/kernel/smp.c | 5 -----
arch/s390/kernel/topology.c | 8 +-------
arch/x86/kernel/smpboot.c | 5 -----
include/linux/sched/topology.h | 8 +++++++-
kernel/sched/topology.c | 7 -------
5 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 7f79b853b221..c58ddf84fe63 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1038,11 +1038,6 @@ static const struct cpumask *smallcore_smt_mask(struct
sched_domain_topology_lev
{
return cpu_smallcore_mask(cpu);
}
-
-static const struct cpumask *tl_smt_mask(struct sched_domain_topology_level
*tl, int cpu)
-{
- return cpu_smt_mask(cpu);
-}
#endif
static struct cpumask *cpu_corgrp_mask(int cpu)
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 5129e3ffa7f5..c88eda847309 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -509,12 +509,6 @@ int topology_cpu_init(struct cpu *cpu)
return rc;
}
-static const struct cpumask *cpu_thread_mask(struct sched_domain_topology_level *tl, int cpu)
-{
- return &cpu_topology[cpu].thread_mask;
-}
-
-
const struct cpumask *cpu_coregroup_mask(int cpu)
{
return &cpu_topology[cpu].core_mask;
@@ -541,7 +535,7 @@ static const struct cpumask *cpu_pkg_mask(struct
sched_domain_topology_level *tl
}
static struct sched_domain_topology_level s390_topology[] = {
- SDTL_INIT(cpu_thread_mask, cpu_smt_flags, SMT),
+ SDTL_INIT(tl_smt_mask, cpu_smt_flags, SMT),
SDTL_INIT(cpu_mc_mask, cpu_core_flags, MC),
SDTL_INIT(cpu_book_mask, NULL, BOOK),
SDTL_INIT(cpu_drawer_mask, NULL, DRAWER),
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 4cd3d69741cf..03ff6270966a 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -463,11 +463,6 @@ static int x86_core_flags(void)
{
return cpu_core_flags() | x86_sched_itmt_flags();
}
-
-static const struct cpumask *tl_smt_mask(struct sched_domain_topology_level
*tl, int cpu)
-{
- return cpu_smt_mask(cpu);
-}
#endif
#ifdef CONFIG_SCHED_CLUSTER
diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
index 602508130c8a..d75fbb7d9667 100644
--- a/include/linux/sched/topology.h
+++ b/include/linux/sched/topology.h
@@ -37,7 +37,13 @@ static inline int cpu_smt_flags(void)
{
return SD_SHARE_CPUCAPACITY | SD_SHARE_LLC;
}
-#endif
+
+static const __maybe_unused
+struct cpumask *tl_smt_mask(struct sched_domain_topology_level *tl, int cpu)
__maybe_unused hides the dust under the carpet.
Leave the function in kernel/sched/topology.c and make it non-static
with a prototype in linux/sched/topology.h
+{
+ return cpu_smt_mask(cpu);
+}
+#endif /* CONFIG_SCHED_SMT */
#ifdef CONFIG_SCHED_CLUSTER
static inline int cpu_cluster_flags(void)
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index dfc754e0668c..92165fe56a2d 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -1724,13 +1724,6 @@ sd_init(struct sched_domain_topology_level *tl,
return sd;
}
-#ifdef CONFIG_SCHED_SMT
-static const struct cpumask *tl_smt_mask(struct sched_domain_topology_level
*tl, int cpu)
-{
- return cpu_smt_mask(cpu);
-}
-#endif
-
#ifdef CONFIG_SCHED_CLUSTER
static const struct cpumask *tl_cls_mask(struct sched_domain_topology_level
*tl, int cpu)
{