Le 26/08/2025 à 06:13, K Prateek Nayak a écrit :
Unify the tl_pkg_mask() wrapper around cpu_nod_mask() across core, x86,
powerpc, and s390.

No functional changes intended.

Signed-off-by: K Prateek Nayak <kprateek.na...@amd.com>
---
  arch/powerpc/kernel/smp.c      | 7 +------
  arch/s390/kernel/topology.c    | 7 +------
  arch/x86/kernel/smpboot.c      | 5 -----
  include/linux/sched/topology.h | 6 ++++++
  kernel/sched/topology.c        | 5 -----
  5 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 40719679385b..8e869c13f7ed 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1064,11 +1064,6 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
  }
  #endif
-static const struct cpumask *cpu_pkg_mask(struct sched_domain_topology_level *tl, int cpu)
-{
-       return cpu_node_mask(cpu);
-}
-
  static int __init init_big_cores(void)
  {
        int cpu;
@@ -1728,7 +1723,7 @@ static void __init build_sched_topology(void)
        }
  #endif
- powerpc_topology[i++] = SDTL_INIT(cpu_pkg_mask, powerpc_shared_proc_flags, PKG);
+       powerpc_topology[i++] = SDTL_INIT(tl_pkg_mask, 
powerpc_shared_proc_flags, PKG);
/* There must be one trailing NULL entry left. */
        BUG_ON(i >= ARRAY_SIZE(powerpc_topology) - 1);
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 8dbf32f362e1..8f5b6ecc055f 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -524,17 +524,12 @@ static const struct cpumask *cpu_drawer_mask(struct 
sched_domain_topology_level
        return &cpu_topology[cpu].drawer_mask;
  }
-static const struct cpumask *cpu_pkg_mask(struct sched_domain_topology_level *tl, int cpu)
-{
-       return cpu_node_mask(cpu);
-}
-
  static struct sched_domain_topology_level s390_topology[] = {
        SDTL_INIT(tl_smt_mask, cpu_smt_flags, SMT),
        SDTL_INIT(tl_mc_mask, cpu_core_flags, MC),
        SDTL_INIT(cpu_book_mask, NULL, BOOK),
        SDTL_INIT(cpu_drawer_mask, NULL, DRAWER),
-       SDTL_INIT(cpu_pkg_mask, NULL, PKG),
+       SDTL_INIT(tl_pkg_mask, NULL, PKG),
        { NULL, },
  };
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index bfbcac9a73d1..6c0ab30a80e2 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -472,11 +472,6 @@ static int x86_cluster_flags(void)
  }
  #endif
-static const struct cpumask *tl_pkg_mask(struct sched_domain_topology_level *tl, int cpu)
-{
-       return cpu_node_mask(cpu);
-}
-
  /*
   * Set if a package/die has multiple NUMA nodes inside.
   * AMD Magny-Cours, Intel Cluster-on-Die, and Intel
diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
index 075d1f063668..807603bfe8ff 100644
--- a/include/linux/sched/topology.h
+++ b/include/linux/sched/topology.h
@@ -71,6 +71,12 @@ struct cpumask *tl_mc_mask(struct 
sched_domain_topology_level *tl, int cpu)
  }
  #endif /* CONFIG_SCHED_MC */
+static const __maybe_unused

Same as the three previous patches, __maybe_unused shouldn't be required.

+struct cpumask *tl_pkg_mask(struct sched_domain_topology_level *tl, int cpu)
+{
+       return cpu_node_mask(cpu);
+}
+
  #ifdef CONFIG_NUMA
  static inline int cpu_numa_flags(void)
  {
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 77d14430c5e1..18889bd97e22 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -1724,11 +1724,6 @@ sd_init(struct sched_domain_topology_level *tl,
        return sd;
  }
-static const struct cpumask *tl_pkg_mask(struct sched_domain_topology_level *tl, int cpu)
-{
-       return cpu_node_mask(cpu);
-}
-
  /*
   * Topology list, bottom-up.
   */


Reply via email to