Re: [PATCH v2] sched/topology: Check average distances to remote packages

Chen, Yu C
2026-02-25T15:40:12Z

On 2/25/2026 8:30 PM, Peter Zijlstra wrote:
> On Tue, Feb 24, 2026 at 07:43:10PM -0600, Kyle Meyer wrote:
>

[ ... ]

>
> And it also shows that using REMOTE_DISTANCE (20) was completely random
> and 'wrong'.
>
> So per 4d6dd05d07d0 ("sched/topology: Fix sched domain build error for GNR, CWF in SNC-3 mode")
>
> Tim's original crazy SNC-3 SLIT table was:
>
> node distances:
> node 0 1 2 3 4 5
> 0: 10 15 17 21 28 26
> 1: 15 10 15 23 26 23
> 2: 17 15 10 26 23 21
> 3: 21 28 26 10 15 17
> 4: 23 26 23 15 10 15
> 5: 26 23 21 17 15 10
>
> And per:
>
> https://lore.kernel.org/lkml/20250825075642.GQ3245006@noisy.programming.kicks-ass.net/
>
> My suggestion was to average the off-trace clusters to restore sanity.
>

In above example, the node distances become:
"Eg. since (21+28+26+23+26+23+26+23+21)/9 ~ 24, you end up with:

node 0 1 2 3 4 5
0: 10 15 17 24 24 24
1: 15 10 15 24 24 24
2: 17 15 10 24 24 24
3: 24 24 24 10 15 17
4: 24 24 24 15 10 15
5: 24 24 24 17 15 10
"

> +
> +static int slit_cluster_distance(int i, int j)
> +{
> + static int u = 0;
> + long d = 0;
> + int x, y;
> +
> + if (!u)
> + u = slit_cluster_size();
> +
> + /*
> + * Is this a unit cluster on the trace?
> + */
> + if ((i / u) == (j / u))
> + return node_distance(i, j);

the u is 3 in above example, because slit_cluster_size()
found that node0, node1 and node2 are in the same biggest
symmetric cluster. Not sure if I understand it correctly,
here we will treat node4 and node5 as the same cluster,
but without checking whether node_distance(4, 5) and
node_distance(5,4) are the same. If node_dist(4,5)!=node_dist(5,4),
will we keep it as it is?

thanks,
Chenyu