diff options
| author | Andi Kleen <ak@suse.de> | 2005-01-03 04:48:54 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-03 04:48:54 -0800 |
| commit | 29ee39a648bf341a35c0a795961ed29fc2d20a9e (patch) | |
| tree | 9dcf00e859f115c1c4a0f8cfb7ea2755e5098604 | |
| parent | 717a232692bf0fa8c28d5c30f753cce6c062b866 (diff) | |
[PATCH] x86_64: Add SLIT (inter node distance) information to sysfs.
Add SLIT (inter node distance) information to sysfs.
[This is Jack's patch that he submitted on l-k. I'm submitting
it for him because I need it for my x86-64 followon SLIT patch.
Hope I don't stomp onto his toes with that one. If you already
merged it please ignore]
From: Jack Steiner
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 10
Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | drivers/base/node.c | 19 | ||||
| -rw-r--r-- | include/asm-i386/topology.h | 3 | ||||
| -rw-r--r-- | include/linux/topology.h | 5 |
3 files changed, 23 insertions, 4 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c index df74785efa5f..26f06914712e 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -111,6 +111,24 @@ static ssize_t node_read_numastat(struct sys_device * dev, char * buf) } 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 *node, int num, struct node *parent) sysdev_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; } diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h index d2c836023a07..efd38639e12d 100644 --- a/include/asm-i386/topology.h +++ b/include/asm-i386/topology.h @@ -66,9 +66,6 @@ static inline cpumask_t pcibus_to_cpumask(int bus) return 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, \ diff --git a/include/linux/topology.h b/include/linux/topology.h index 10df2542653b..1206d5a983a9 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h @@ -55,7 +55,10 @@ static inline int __next_node_with_cpus(int node) 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) |
