aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2011-05-24 20:11:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-25 11:39:07 -0400
commitfa25c503dfa203b921199ea42c0046c89f2ed49f (patch)
tree9a56c17ffda1183c66dc112ceba76ece65f0a4e6 /drivers
parentbb005a59e08733bb416126dc184f73120fc6366b (diff)
mm: per-node vmstat: show proper vmstats
commit 2ac390370a ("writeback: add /sys/devices/system/node/<node>/vmstat") added vmstat entry. But strangely it only show nr_written and nr_dirtied. # cat /sys/devices/system/node/node20/vmstat nr_written 0 nr_dirtied 0 Of course, It's not adequate. With this patch, the vmstat show all vm stastics as /proc/vmstat. # cat /sys/devices/system/node/node0/vmstat nr_free_pages 899224 nr_inactive_anon 201 nr_active_anon 17380 nr_inactive_file 31572 nr_active_file 28277 nr_unevictable 0 nr_mlock 0 nr_anon_pages 17321 nr_mapped 8640 nr_file_pages 60107 nr_dirty 33 nr_writeback 0 nr_slab_reclaimable 6850 nr_slab_unreclaimable 7604 nr_page_table_pages 3105 nr_kernel_stack 175 nr_unstable 0 nr_bounce 0 nr_vmscan_write 0 nr_writeback_temp 0 nr_isolated_anon 0 nr_isolated_file 0 nr_shmem 260 nr_dirtied 1050 nr_written 938 numa_hit 962872 numa_miss 0 numa_foreign 0 numa_interleave 8617 numa_local 962872 numa_other 0 nr_anon_transparent_hugepages 0 [akpm@linux-foundation.org: no externs in .c files] Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Michael Rubin <mrubin@google.com> Cc: Wu Fengguang <fengguang.wu@intel.com> Acked-by: David Rientjes <rientjes@google.com> Cc: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/node.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index b3b72d64e805..793f796c4da3 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -7,6 +7,7 @@
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/mm.h> 8#include <linux/mm.h>
9#include <linux/memory.h> 9#include <linux/memory.h>
10#include <linux/vmstat.h>
10#include <linux/node.h> 11#include <linux/node.h>
11#include <linux/hugetlb.h> 12#include <linux/hugetlb.h>
12#include <linux/compaction.h> 13#include <linux/compaction.h>
@@ -179,11 +180,14 @@ static ssize_t node_read_vmstat(struct sys_device *dev,
179 struct sysdev_attribute *attr, char *buf) 180 struct sysdev_attribute *attr, char *buf)
180{ 181{
181 int nid = dev->id; 182 int nid = dev->id;
182 return sprintf(buf, 183 int i;
183 "nr_written %lu\n" 184 int n = 0;
184 "nr_dirtied %lu\n", 185
185 node_page_state(nid, NR_WRITTEN), 186 for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
186 node_page_state(nid, NR_DIRTIED)); 187 n += sprintf(buf+n, "%s %lu\n", vmstat_text[i],
188 node_page_state(nid, i));
189
190 return n;
187} 191}
188static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL); 192static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL);
189 193