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];
...