Externalize SLIT table
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 20041104.105908.18574694.t-kochi@bq.jp.nec.com.suse.lists.linux.kernel
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 20041104.135721.08317994.t-kochi@bq.jp.nec.com.suse.lists.linux.kernel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Review
Quoted 9 lines · Jack Steiner
(quoted diff) +8
-0+static ssize_t node_read_distance(struct sys_device * dev, char * buf) +{ + int nid = dev->id; + int len = 0; + int i; + + for (i = 0; i < numnodes; i++) + len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i));
One problem is that most architectures define node_distance currently as nid != i. This would give 0 on them for the identity mapping and 10 on IA64 which uses the SLIT values. Not good for a portable interface. I would suggest to at least change them to return 10 for a zero node distance.
Also in general I would prefer if you could move all the SLIT parsing into drivers/acpi/numa.c. Then the other ACPI architectures don't need to copy the basically identical code from ia64.
-Andi
(Sorry for the delay in posting this. Our mail server was dropping mail ....)
Here is an update patch to externalize the SLIT information. I think I have encorporated all the comments that were posted previously)
For example:
# cd /sys/devices/system
# find .
./node
./node/node5
./node/node5/distance
./node/node5/numastat
./node/node5/meminfo
./node/node5/cpumap # cat ./node/node0/distance
10 20 64 42 42 22 # cat node/*/distance
10 20 64 42 42 22
20 10 42 22 64 84
64 42 10 20 22 42
42 22 20 10 42 62
42 64 22 42 10 20
22 84 42 62 20 10Does this look ok???
Add SLIT (inter node distance) information to sysfs.
drivers/base/node.c +19 -0
@@ -111,6 +111,24 @@ static ssize_t node_read_numastat(struct } static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); +static ssize_t node_read_distance (struct sys_device * dev,char * buf) +{ +int nid = dev->id; +int len =0 ; +int i; + +/* buf currently PAGE_SIZE, need ~4 chars per node */ +BUILD_BUG_ON (NR_NODES *4 >PAGE_SIZE /2 ); + +for (i =0 ; i < numnodes; i++) + len +=sprintf (buf + len,"%s%d" , i ?" " :"" ,node_distance (nid, i)); + + len +=sprintf (buf + len,"\n" ); +return len; +} +static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL); + +/* * register_node - Setup a driverfs device for a node. * @num - Node number to use when creating the device.
@@ -129,6 +147,7 @@ int __init register_node(struct node *nosysdev_create_file (&node->sysdev, &attr_cpumap);sysdev_create_file (&node->sysdev, &attr_meminfo);sysdev_create_file (&node->sysdev, &attr_numastat); +sysdev_create_file (&node->sysdev, &attr_distance); }return error; }
include/asm-i386/topology.h +0 -3
@@ -66,9 +66,6 @@ static inline cpumask_t pcibus_to_cpumasreturn node_to_cpumask (mp_bus_id_to_node[bus]); } -/* Node-to-Node distance */ -#define node_distance (from, to) ((from) != (to)) -/* sched_domains SD_NODE_INIT for NUMAQ machines */ #define SD_NODE_INIT (struct sched_domain) { \ .span = CPU_MASK_NONE, \
include/linux/topology.h +4 -1
@@ -55,7 +55,10 @@ static inline int __next_node_with_cpus( for (node = 0; node < numnodes; node = __next_node_with_cpus(node))#ifndef node_distance -#define node_distance (from,to) ((from) != (to)) +/* Conform to ACPI 2.0 SLIT distance definitions */ +#define LOCAL_DISTANCE 10 +#define REMOTE_DISTANCE 20 +#define node_distance (from,to) ((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)#endif #ifndef PENALTY_FOR_NODE_WITH_CPUS #define PENALTY_FOR_NODE_WITH_CPUS (1)
Signature · 4 lines
Thanks Jack Steiner ([email protected]) 651-683-5302 Principal Engineer SGI - Silicon Graphics, Inc.
Quoted 2 lines · Jack Steiner
(Sorry for the delay in posting this. Our mail server was dropping mail ....)
Looks good. Thanks. I actually came up with my own patch now (which ended up quite similar), but yours looks slightly better.
-Andi