diff options
author | Michael Rubin <mrubin@google.com> | 2010-10-26 17:21:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-26 19:52:06 -0400 |
commit | 2ac390370aac4aaa49cab17f328b478cbd5b3d8d (patch) | |
tree | 6d57a59cbe07b73b402f965c1e788e39115ffbc3 /drivers/base | |
parent | ea941f0e2a8c02ae876cd73deb4e1557248f258c (diff) |
writeback: add /sys/devices/system/node/<node>/vmstat
For NUMA node systems it is important to have visibility in memory
characteristics. Two of the /proc/vmstat values "nr_written" and
"nr_dirtied" are added here.
# cat /sys/devices/system/node/node20/vmstat
nr_written 0
nr_dirtied 0
Signed-off-by: Michael Rubin <mrubin@google.com>
Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/node.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c index ee53558b452f..ce012a9c6201 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
@@ -160,6 +160,18 @@ static ssize_t node_read_numastat(struct sys_device * dev, | |||
160 | } | 160 | } |
161 | static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); | 161 | static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); |
162 | 162 | ||
163 | static ssize_t node_read_vmstat(struct sys_device *dev, | ||
164 | struct sysdev_attribute *attr, char *buf) | ||
165 | { | ||
166 | int nid = dev->id; | ||
167 | return sprintf(buf, | ||
168 | "nr_written %lu\n" | ||
169 | "nr_dirtied %lu\n", | ||
170 | node_page_state(nid, NR_WRITTEN), | ||
171 | node_page_state(nid, NR_DIRTIED)); | ||
172 | } | ||
173 | static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL); | ||
174 | |||
163 | static ssize_t node_read_distance(struct sys_device * dev, | 175 | static ssize_t node_read_distance(struct sys_device * dev, |
164 | struct sysdev_attribute *attr, char * buf) | 176 | struct sysdev_attribute *attr, char * buf) |
165 | { | 177 | { |
@@ -243,6 +255,7 @@ int register_node(struct node *node, int num, struct node *parent) | |||
243 | sysdev_create_file(&node->sysdev, &attr_meminfo); | 255 | sysdev_create_file(&node->sysdev, &attr_meminfo); |
244 | sysdev_create_file(&node->sysdev, &attr_numastat); | 256 | sysdev_create_file(&node->sysdev, &attr_numastat); |
245 | sysdev_create_file(&node->sysdev, &attr_distance); | 257 | sysdev_create_file(&node->sysdev, &attr_distance); |
258 | sysdev_create_file(&node->sysdev, &attr_vmstat); | ||
246 | 259 | ||
247 | scan_unevictable_register_node(node); | 260 | scan_unevictable_register_node(node); |
248 | 261 | ||
@@ -267,6 +280,7 @@ void unregister_node(struct node *node) | |||
267 | sysdev_remove_file(&node->sysdev, &attr_meminfo); | 280 | sysdev_remove_file(&node->sysdev, &attr_meminfo); |
268 | sysdev_remove_file(&node->sysdev, &attr_numastat); | 281 | sysdev_remove_file(&node->sysdev, &attr_numastat); |
269 | sysdev_remove_file(&node->sysdev, &attr_distance); | 282 | sysdev_remove_file(&node->sysdev, &attr_distance); |
283 | sysdev_remove_file(&node->sysdev, &attr_vmstat); | ||
270 | 284 | ||
271 | scan_unevictable_unregister_node(node); | 285 | scan_unevictable_unregister_node(node); |
272 | hugetlb_unregister_node(node); /* no-op, if memoryless node */ | 286 | hugetlb_unregister_node(node); /* no-op, if memoryless node */ |