[patch -mm 6/7] x86_64: export physnode mapping to userspace
From: David Rientjes
Date: Thu Mar 01 2007 - 12:15:54 EST
Exports the physical NUMA node to fake NUMA node mapping to user-space via
sysfs. The information is now accessible via the 'physnode' file.
Cc: Andi Kleen <ak@xxxxxxx>
Signed-off-by: Rohit Seth <rohitseth@xxxxxxxxxx>
Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
---
drivers/base/node.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/drivers/base/node.c b/drivers/base/node.c
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -133,6 +133,13 @@ static ssize_t node_read_distance(struct sys_device * dev, char * buf)
}
static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL);
+#ifdef CONFIG_NUMA_EMU
+static ssize_t node_read_physnode(struct sys_device *dev, char *buf)
+{
+ return sprintf(buf, "%d\n", get_phys_node(dev->id));
+}
+static SYSDEV_ATTR(physnode, S_IRUGO, node_read_physnode, NULL);
+#endif
/*
* register_node - Setup a driverfs device for a node.
@@ -153,6 +160,9 @@ int register_node(struct node *node, int num, struct node *parent)
sysdev_create_file(&node->sysdev, &attr_meminfo);
sysdev_create_file(&node->sysdev, &attr_numastat);
sysdev_create_file(&node->sysdev, &attr_distance);
+#ifdef CONFIG_NUMA_EMU
+ sysdev_create_file(&node->sysdev, &attr_physnode);
+#endif
}
return error;
}
@@ -170,6 +180,9 @@ void unregister_node(struct node *node)
sysdev_remove_file(&node->sysdev, &attr_meminfo);
sysdev_remove_file(&node->sysdev, &attr_numastat);
sysdev_remove_file(&node->sysdev, &attr_distance);
+#ifdef CONFIG_NUMA_EMU
+ sysdev_remove_file(&node->sysdev, &attr_physnode);
+#endif
sysdev_unregister(&node->sysdev);
}
-
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/