Question about NUMA distance calculation in powerpc/mm/numa.c
Michael Ellerman
mpe at ellerman.id.au
Tue Jul 21 11:36:40 AEST 2020
Daniel Henrique Barboza <danielhb413 at gmail.com> writes:
> Hello,
>
>
> I didn't find an explanation about the 'double the distance' logic in
> 'git log' or anywhere in the kernel docs:
>
>
> (arch/powerpc/mm/numa.c, __node_distance()):
Adding more context:
int distance = LOCAL_DISTANCE;
...
> for (i = 0; i < distance_ref_points_depth; i++) {
> if (distance_lookup_table[a][i] == distance_lookup_table[b][i])
> break;
>
> /* Double the distance for each NUMA level */
> distance *= 2;
> }
And:
#define LOCAL_DISTANCE 10
#define REMOTE_DISTANCE 20
So AFAICS the doubling is just a way to ensure we go from LOCAL_DISTANCE
to REMOTE_DISTANCE at the first level, and then after that it's fairly
arbitrary.
cheers
More information about the Linuxppc-dev
mailing list