[PATCH 2/2] sched/numa: Apply remote socket distance averaging for Hygon 7447V

From: Chaohong Guo

Date: Mon Aug 03 2026 - 01:39:29 EST


On Intel GNR/CWF platforms with SNC3 enabled, the patch:
commit 4d6dd05d07d0 ("sched/topology: Fix sched domain build error
for GNR, CWF in SNC-3 mode") introduced the use of averaged distances
to remote‑socket nodes when constructing scheduling domains. This
helped group remote‑socket NUMA nodes into the same scheduling group,
improving load‑balancing decisions

Hygon 7447V (model 7) can contain up to six dies per package. When NPS
(NUMA per socket) is enabled, each package exposes six NUMA nodes. We
observe the same issue as on GNR/CWF: the current domain construction
incorrectly merges nodes from different sockets at higher NUMA levels,
leading to suboptimal remote‑socket CPU selection during load balancing.

The following diagram illustrates the node topology (two packages, six
nodes each):

package 0 package 1

----------------------------------------------
| -------------------- |
| | | |
------ ------- ------ ------
| 0 |------| 3 | | 6 |-------| 9 |
------ ------- ----- -----
| | | |
------- ------- ----- ------
| 5 |------| 2 | | 11 |-------| 8 |
------- ------- ----- -----
| | | |
------- ------- ----- ------
| 4 |------| 1 | | 10 |-------| 7 |
------ ------- ----- ------
| | | |
| -------------------- |
----------------------------------------------

>From the perspective of CPUs in node 0, sched domains:
numa-level 1 : [0] [3] [5]
numa-level 2: [0, 3, 5], [2], [4]
numa-level 3: [0, 2, 3, 4, 5], [1, 2, 3, 4, 5]
numa-level 4: [0-5], [9]
numa-level 5: [0-5, 9], [6], [8]
numa-level 6: [0-6, 8, 9], [7], [11]
numa-level 7: [0-9], [2-11]

NUMA level 5-7, nodes in different socket are grouped together,which
caused CPUs in remote socket are chosen while load balancing.

For better perfornace, we do the same as Intel is doing on intel GNR/CWF.

Signed-off-by: Chaohong Guo <guochaohong@xxxxxxxxxxxxxx>
Co-developed-by: Zhiquan Li <lizhiquan@xxxxxxxxxxxxxx>
Signed-off-by: Zhiquan Li <lizhiquan@xxxxxxxxxxxxxx>
--
2.18.2
---
arch/x86/kernel/smpboot.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index cb999feb66b0..c2131277763a 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -678,6 +678,7 @@ int arch_sched_node_distance(int from, int to)
switch (boot_cpu_data.x86_vfm) {
case INTEL_GRANITERAPIDS_X:
case INTEL_ATOM_DARKMONT_X:
+ case HYGON_7447V:
if (topology_max_packages() == 1 ||
topology_num_nodes_per_package() < 3)
return d;
--
2.18.2