x86/topo: Replace x86_has_numa_in_package

.. with the brand spanking new topology_num_nodes_per_package().

Having the topology setup determine this value during MADT/SRAT parsing before
SMP bringup avoids having to detect this situation when building the SMP
topology masks.

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Reviewed-by: Ingo Molnar <[email protected]>
Tested-by: Tony Luck <[email protected]>
Tested-by: K Prateek Nayak <[email protected]>
Tested-by: Zhang Rui <[email protected]>
Tested-by: Chen Yu <[email protected]>
Tested-by: Kyle Meyer <[email protected]>
Link: https://patch.msgid.link/[email protected]
This commit is contained in:
Peter Zijlstra
2026-03-04 16:35:08 +01:00
parent ae6730ff42
commit 717b64d58c
+3 -10
View File
@@ -468,13 +468,6 @@ static int x86_cluster_flags(void)
}
#endif
/*
* Set if a package/die has multiple NUMA nodes inside.
* AMD Magny-Cours, Intel Cluster-on-Die, and Intel
* Sub-NUMA Clustering have this.
*/
static bool x86_has_numa_in_package;
static struct sched_domain_topology_level x86_topology[] = {
SDTL_INIT(tl_smt_mask, cpu_smt_flags, SMT),
#ifdef CONFIG_SCHED_CLUSTER
@@ -496,7 +489,7 @@ static void __init build_sched_topology(void)
* PKG domain since the NUMA domains will auto-magically create the
* right spanning domains based on the SLIT.
*/
if (x86_has_numa_in_package) {
if (topology_num_nodes_per_package() > 1) {
unsigned int pkgdom = ARRAY_SIZE(x86_topology) - 2;
memset(&x86_topology[pkgdom], 0, sizeof(x86_topology[pkgdom]));
@@ -550,7 +543,7 @@ int arch_sched_node_distance(int from, int to)
case INTEL_GRANITERAPIDS_X:
case INTEL_ATOM_DARKMONT_X:
if (!x86_has_numa_in_package || topology_max_packages() == 1 ||
if (topology_max_packages() == 1 || topology_num_nodes_per_package() == 1 ||
d < REMOTE_DISTANCE)
return d;
@@ -606,7 +599,7 @@ void set_cpu_sibling_map(int cpu)
o = &cpu_data(i);
if (match_pkg(c, o) && !topology_same_node(c, o))
x86_has_numa_in_package = true;
WARN_ON_ONCE(topology_num_nodes_per_package() == 1);
if ((i == cpu) || (has_smt && match_smt(c, o)))
link_mask(topology_sibling_cpumask, cpu, i);