Re: [PATCH] x86, numa: seperate alloc_numa_distance from numa_reset_distance.

From: Cyrill Gorcunov
Date: Wed Feb 16 2011 - 17:47:18 EST


On 02/17/2011 01:29 AM, Yinghai Lu wrote:
On 02/16/2011 01:44 PM, Cyrill Gorcunov wrote:
On 02/16/2011 11:57 PM, Yinghai Lu wrote:

alloc code is much bigger the setting self.

...
+
+ numa_distance = __va(phys);
+ numa_distance_cnt = cnt;
+
+ /* fill with the default distances */
+ for (i = 0; i< cnt; i++)
+ for (j = 0; j< cnt; j++)
+ numa_distance[i * cnt + j] = i == j ?
+ LOCAL_DISTANCE : REMOTE_DISTANCE;
+ printk(KERN_DEBUG "NUMA: Initialized distance table, cnt=%d\n",
cnt);
+}
+

Hi Yinghai, btw would it be convenient to use node_distance() helper here
(since this snippet is touched anyway and there is a big merging of numa
code), ie

/* fill with the default distances */
for (i = 0; i< cnt; i++)
for (j = 0; j< cnt; j++)
numa_distance[i * cnt + j] = node_distance(i, j);

though it should be patch on top of yours to not mix with plain code move

do you mean

int __node_distance(int from, int to)
{
if (from>= numa_distance_cnt || to>= numa_distance_cnt)
return from == to ? LOCAL_DISTANCE : REMOTE_DISTANCE;
return numa_distance[from * numa_distance_cnt + to];
}
EXPORT_SYMBOL(__node_distance);

or node_distance()?

then you will have

numa_distance[i * cnt + j] = numa_distance[i * cnt + j];

...

Ah, yeah, I mentally swapped >= to <= which is not true of course,
drop this idea, sorry.

--
Cyrill
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/