<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>[PATCH] mm: per-node vmstat show proper vmstats</title>
        <description> commit 2ac390370a (writeback: add /sys/devices/system/node/&amp;lt;node&amp;gt;/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 cource, It's no 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

Signed-off-by: KOSAKI Motohiro &amp;lt;kosaki.motohiro@jp.fujitsu.com&amp;gt;
Cc: Michael Rubin &amp;lt;mrubin@google.com&amp;gt;
Cc: Wu Fengguang &amp;lt;fengguang.wu@intel.com&amp;gt;
---
 drivers/base/node.c |   15 ++++++++++-----
 mm/vmstat.c         |    2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index b3b72d6..3fc5f28 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -175,15 +175,20 @@ static ssize_t node_read_numastat(struct sys_device * dev,
 }
 static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
 
+extern const char * const vmstat_text[];
+
 static ssize_t node_read_vmstat(struct sys_device *dev,
 				struct sysdev_attribute *attr, char *buf)
 {
 	int nid = dev-&amp;gt;id;
-	return sprintf(buf,
-		&amp;quot;nr_written %lu\n&amp;quot;
-		&amp;quot;nr_dirtied %lu\n&amp;quot;,
-		node_page_state(nid, NR_WRITTEN),
-		node_page_state(nid, NR_DIRTIED));
+	int i;
+	int n = 0;
+
+	for (i = 0; i &amp;lt; NR_VM_ZONE_STAT_ITEMS; i++)
+		n += sprintf(buf+n, &amp;quot;%s %lu\n&amp;quot;, vmstat_text,
+			     node_page_state(nid, i));
+
+	return n;
 }
 static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL);
 
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 897ea9e..0000aad 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -852,7 +852,7 @@ static const struct file_operations pagetypeinfo_file_ops = {
 #define TEXTS_FOR_ZONES(xx) TEXT_FOR_DMA(xx) TEXT_FOR_DMA32(xx) xx &amp;quot;_normal&amp;quot;, \
 					TEXT_FOR_HIGHMEM(xx) xx &amp;quot;_movable&amp;quot;,
 
-static const char * const vmstat_text[] = {
+const char * const vmstat_text[] = {
 	/* Zoned VM counters */
 	&amp;quot;nr_free_pages&amp;quot;,
 	&amp;quot;nr_inactive_anon&amp;quot;,
-- 
1.7.3.1



--
To unsubscribe from this list: send the line &amp;quot;unsubscribe linux-kernel&amp;quot; in
the body of a message to &amp;#109;&amp;#97;&amp;#106;&amp;#111;&amp;#114;&amp;#100;&amp;#111;&amp;#109;&amp;#111;&amp;#64;&amp;#118;&amp;#103;&amp;#101;&amp;#114;&amp;#46;&amp;#107;&amp;#101;&amp;#114;&amp;#110;&amp;#101;&amp;#108;&amp;#46;&amp;#111;&amp;#114;&amp;#103;
More majordomo info at  [vger.kernel.org]
Please read the FAQ at  [www.tux.org]</description>
        <link>http://choon.net/forum/read.php?21,31514,31514#msg-31514</link>
        <lastBuildDate>Sun, 26 May 2013 04:10:41 +0800</lastBuildDate>
        <generator>Phorum 5.2.19</generator>
        <item>
            <guid>http://choon.net/forum/read.php?21,31514,34671#msg-34671</guid>
            <title>Re: [PATCH] mm: per-node vmstat show proper vmstats</title>
            <link>http://choon.net/forum/read.php?21,31514,34671#msg-34671</link>
            <description><![CDATA[ On Mon, 11 Apr 2011, KOSAKI Motohiro wrote:<br />
<br />
&gt; commit 2ac390370a (writeback: add /sys/devices/system/node/&lt;node&gt;/vmstat)<br />
&gt; added vmstat entry. But strangely it only show nr_written and nr_dirtied.<br />
&gt; <br />
&gt;         # cat /sys/devices/system/node/node20/vmstat<br />
&gt;         nr_written 0<br />
&gt;         nr_dirtied 0<br />
&gt; <br />
&gt; Of cource, It's no adequate. With this patch, the vmstat show<br />
&gt; all vm stastics as /proc/vmstat.<br />
&gt; <br />
&gt;         # cat /sys/devices/system/node/node0/vmstat<br />
&gt; 	nr_free_pages 899224<br />
&gt; 	nr_inactive_anon 201<br />
&gt; 	nr_active_anon 17380<br />
&gt; 	nr_inactive_file 31572<br />
&gt; 	nr_active_file 28277<br />
&gt; 	nr_unevictable 0<br />
&gt; 	nr_mlock 0<br />
&gt; 	nr_anon_pages 17321<br />
&gt; 	nr_mapped 8640<br />
&gt; 	nr_file_pages 60107<br />
&gt; 	nr_dirty 33<br />
&gt; 	nr_writeback 0<br />
&gt; 	nr_slab_reclaimable 6850<br />
&gt; 	nr_slab_unreclaimable 7604<br />
&gt; 	nr_page_table_pages 3105<br />
&gt; 	nr_kernel_stack 175<br />
&gt; 	nr_unstable 0<br />
&gt; 	nr_bounce 0<br />
&gt; 	nr_vmscan_write 0<br />
&gt; 	nr_writeback_temp 0<br />
&gt; 	nr_isolated_anon 0<br />
&gt; 	nr_isolated_file 0<br />
&gt; 	nr_shmem 260<br />
&gt; 	nr_dirtied 1050<br />
&gt; 	nr_written 938<br />
&gt; 	numa_hit 962872<br />
&gt; 	numa_miss 0<br />
&gt; 	numa_foreign 0<br />
&gt; 	numa_interleave 8617<br />
&gt; 	numa_local 962872<br />
&gt; 	numa_other 0<br />
&gt; 	nr_anon_transparent_hugepages 0<br />
&gt; <br />
&gt; Signed-off-by: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;<br />
&gt; Cc: Michael Rubin &lt;mrubin@google.com&gt;<br />
&gt; Cc: Wu Fengguang &lt;fengguang.wu@intel.com&gt;<br />
<br />
This is very useful for cpuset users.<br />
<br />
Acked-by: David Rientjes &lt;rientjes@google.com&gt;<br />
--<br />
To unsubscribe from this list: send the line &quot;unsubscribe linux-kernel&quot; in<br />
the body of a message to <a href="mailto:&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;">&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;</a><br />
More majordomo info at  [<a href="http://vger.kernel.org/majordomo-info.html"  rel="nofollow">vger.kernel.org</a>]<br />
Please read the FAQ at  [<a href="http://www.tux.org/lkml/"  rel="nofollow">www.tux.org</a>]]]></description>
            <dc:creator>David Rientjes</dc:creator>
            <category>Linux Kernel</category>
            <pubDate>Wed, 13 Apr 2011 07:56:02 +0800</pubDate>
        </item>
        <item>
            <guid>http://choon.net/forum/read.php?21,31514,31527#msg-31527</guid>
            <title>Re: [PATCH] mm: per-node vmstat show proper vmstats</title>
            <link>http://choon.net/forum/read.php?21,31514,31527#msg-31527</link>
            <description><![CDATA[ &gt; With this patch, the vmstat show all vm stastics as /proc/vmstat.<br />
<br />
Nice! It's good to see all the per-node vmstats, here are my numbers :)<br />
<br />
wfg@fat ~% cat /sys/devices/system/node/node0/vmstat<br />
nr_free_pages 67026<br />
nr_inactive_anon 147<br />
nr_active_anon 3697<br />
nr_inactive_file 611711<br />
nr_active_file 2291<br />
nr_unevictable 0<br />
nr_mlock 0<br />
nr_anon_pages 3623<br />
nr_mapped 2165<br />
nr_file_pages 614269<br />
nr_dirty 116123<br />
nr_writeback 23596<br />
nr_slab_reclaimable 25178<br />
nr_slab_unreclaimable 6946<br />
nr_page_table_pages 380<br />
nr_kernel_stack 142<br />
nr_unstable 0<br />
nr_bounce 0<br />
nr_vmscan_write 0<br />
nr_writeback_temp 0<br />
nr_isolated_anon 0<br />
nr_isolated_file 0<br />
nr_shmem 153<br />
nr_dirtied 605215<br />
nr_written 489092<br />
numa_hit 1199939<br />
numa_miss 0<br />
numa_foreign 0<br />
numa_interleave 7408<br />
numa_local 1199939<br />
numa_other 0<br />
nr_anon_transparent_hugepages 0<br />
<br />
Thanks,<br />
Fengguang<br />
<br />
On Mon, Apr 11, 2011 at 07:10:19PM +0800, KOSAKI Motohiro wrote:<br />
&gt; commit 2ac390370a (writeback: add /sys/devices/system/node/&lt;node&gt;/vmstat)<br />
&gt; added vmstat entry. But strangely it only show nr_written and nr_dirtied.<br />
&gt; <br />
&gt;         # cat /sys/devices/system/node/node20/vmstat<br />
&gt;         nr_written 0<br />
&gt;         nr_dirtied 0<br />
&gt; <br />
&gt; Of cource, It's no adequate. With this patch, the vmstat show<br />
&gt; all vm stastics as /proc/vmstat.<br />
&gt; <br />
&gt;         # cat /sys/devices/system/node/node0/vmstat<br />
&gt; 	nr_free_pages 899224<br />
&gt; 	nr_inactive_anon 201<br />
&gt; 	nr_active_anon 17380<br />
&gt; 	nr_inactive_file 31572<br />
&gt; 	nr_active_file 28277<br />
&gt; 	nr_unevictable 0<br />
&gt; 	nr_mlock 0<br />
&gt; 	nr_anon_pages 17321<br />
&gt; 	nr_mapped 8640<br />
&gt; 	nr_file_pages 60107<br />
&gt; 	nr_dirty 33<br />
&gt; 	nr_writeback 0<br />
&gt; 	nr_slab_reclaimable 6850<br />
&gt; 	nr_slab_unreclaimable 7604<br />
&gt; 	nr_page_table_pages 3105<br />
&gt; 	nr_kernel_stack 175<br />
&gt; 	nr_unstable 0<br />
&gt; 	nr_bounce 0<br />
&gt; 	nr_vmscan_write 0<br />
&gt; 	nr_writeback_temp 0<br />
&gt; 	nr_isolated_anon 0<br />
&gt; 	nr_isolated_file 0<br />
&gt; 	nr_shmem 260<br />
&gt; 	nr_dirtied 1050<br />
&gt; 	nr_written 938<br />
&gt; 	numa_hit 962872<br />
&gt; 	numa_miss 0<br />
&gt; 	numa_foreign 0<br />
&gt; 	numa_interleave 8617<br />
&gt; 	numa_local 962872<br />
&gt; 	numa_other 0<br />
&gt; 	nr_anon_transparent_hugepages 0<br />
&gt; <br />
&gt; Signed-off-by: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;<br />
&gt; Cc: Michael Rubin &lt;mrubin@google.com&gt;<br />
&gt; Cc: Wu Fengguang &lt;fengguang.wu@intel.com&gt;<br />
&gt; ---<br />
&gt;  drivers/base/node.c |   15 ++++++++++-----<br />
&gt;  mm/vmstat.c         |    2 +-<br />
&gt;  2 files changed, 11 insertions(+), 6 deletions(-)<br />
&gt; <br />
&gt; diff --git a/drivers/base/node.c b/drivers/base/node.c<br />
&gt; index b3b72d6..3fc5f28 100644<br />
&gt; --- a/drivers/base/node.c<br />
&gt; +++ b/drivers/base/node.c<br />
&gt; @@ -175,15 +175,20 @@ static ssize_t node_read_numastat(struct sys_device * dev,<br />
&gt;  }<br />
&gt;  static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);<br />
&gt;  <br />
&gt; +extern const char * const vmstat_text[];<br />
&gt; +<br />
&gt;  static ssize_t node_read_vmstat(struct sys_device *dev,<br />
&gt;  				struct sysdev_attribute *attr, char *buf)<br />
&gt;  {<br />
&gt;  	int nid = dev-&gt;id;<br />
&gt; -	return sprintf(buf,<br />
&gt; -		&quot;nr_written %lu\n&quot;<br />
&gt; -		&quot;nr_dirtied %lu\n&quot;,<br />
&gt; -		node_page_state(nid, NR_WRITTEN),<br />
&gt; -		node_page_state(nid, NR_DIRTIED));<br />
&gt; +	int i;<br />
&gt; +	int n = 0;<br />
&gt; +<br />
&gt; +	for (i = 0; i &lt; NR_VM_ZONE_STAT_ITEMS; i++)<br />
&gt; +		n += sprintf(buf+n, &quot;%s %lu\n&quot;, vmstat_text<i>,<br />
&gt; +			     node_page_state(nid, i));<br />
&gt; +<br />
&gt; +	return n;<br />
&gt;  }<br />
&gt;  static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL);<br />
&gt;  <br />
&gt; diff --git a/mm/vmstat.c b/mm/vmstat.c<br />
&gt; index 897ea9e..0000aad 100644<br />
&gt; --- a/mm/vmstat.c<br />
&gt; +++ b/mm/vmstat.c<br />
&gt; @@ -852,7 +852,7 @@ static const struct file_operations pagetypeinfo_file_ops = {<br />
&gt;  #define TEXTS_FOR_ZONES(xx) TEXT_FOR_DMA(xx) TEXT_FOR_DMA32(xx) xx &quot;_normal&quot;, \<br />
&gt;  					TEXT_FOR_HIGHMEM(xx) xx &quot;_movable&quot;,<br />
&gt;  <br />
&gt; -static const char * const vmstat_text[] = {<br />
&gt; +const char * const vmstat_text[] = {<br />
&gt;  	/* Zoned VM counters */<br />
&gt;  	&quot;nr_free_pages&quot;,<br />
&gt;  	&quot;nr_inactive_anon&quot;,<br />
&gt; -- <br />
&gt; 1.7.3.1<br />
&gt; <br />
&gt; <br />
--<br />
To unsubscribe from this list: send the line &quot;unsubscribe linux-kernel&quot; in<br />
the body of a message to <a href="mailto:&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;">&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;</a><br />
More majordomo info at  [<a href="http://vger.kernel.org/majordomo-info.html"  rel="nofollow">vger.kernel.org</a>]<br />
Please read the FAQ at  [<a href="http://www.tux.org/lkml/"  rel="nofollow">www.tux.org</a>]</i>]]></description>
            <dc:creator>Wu Fengguang</dc:creator>
            <category>Linux Kernel</category>
            <pubDate>Mon, 11 Apr 2011 19:22:02 +0800</pubDate>
        </item>
        <item>
            <guid>http://choon.net/forum/read.php?21,31514,31514#msg-31514</guid>
            <title>[PATCH] mm: per-node vmstat show proper vmstats</title>
            <link>http://choon.net/forum/read.php?21,31514,31514#msg-31514</link>
            <description><![CDATA[ commit 2ac390370a (writeback: add /sys/devices/system/node/&lt;node&gt;/vmstat)<br />
added vmstat entry. But strangely it only show nr_written and nr_dirtied.<br />
<br />
        # cat /sys/devices/system/node/node20/vmstat<br />
        nr_written 0<br />
        nr_dirtied 0<br />
<br />
Of cource, It's no adequate. With this patch, the vmstat show<br />
all vm stastics as /proc/vmstat.<br />
<br />
        # cat /sys/devices/system/node/node0/vmstat<br />
	nr_free_pages 899224<br />
	nr_inactive_anon 201<br />
	nr_active_anon 17380<br />
	nr_inactive_file 31572<br />
	nr_active_file 28277<br />
	nr_unevictable 0<br />
	nr_mlock 0<br />
	nr_anon_pages 17321<br />
	nr_mapped 8640<br />
	nr_file_pages 60107<br />
	nr_dirty 33<br />
	nr_writeback 0<br />
	nr_slab_reclaimable 6850<br />
	nr_slab_unreclaimable 7604<br />
	nr_page_table_pages 3105<br />
	nr_kernel_stack 175<br />
	nr_unstable 0<br />
	nr_bounce 0<br />
	nr_vmscan_write 0<br />
	nr_writeback_temp 0<br />
	nr_isolated_anon 0<br />
	nr_isolated_file 0<br />
	nr_shmem 260<br />
	nr_dirtied 1050<br />
	nr_written 938<br />
	numa_hit 962872<br />
	numa_miss 0<br />
	numa_foreign 0<br />
	numa_interleave 8617<br />
	numa_local 962872<br />
	numa_other 0<br />
	nr_anon_transparent_hugepages 0<br />
<br />
Signed-off-by: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;<br />
Cc: Michael Rubin &lt;mrubin@google.com&gt;<br />
Cc: Wu Fengguang &lt;fengguang.wu@intel.com&gt;<br />
---<br />
 drivers/base/node.c |   15 ++++++++++-----<br />
 mm/vmstat.c         |    2 +-<br />
 2 files changed, 11 insertions(+), 6 deletions(-)<br />
<br />
diff --git a/drivers/base/node.c b/drivers/base/node.c<br />
index b3b72d6..3fc5f28 100644<br />
--- a/drivers/base/node.c<br />
+++ b/drivers/base/node.c<br />
@@ -175,15 +175,20 @@ static ssize_t node_read_numastat(struct sys_device * dev,<br />
 }<br />
 static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);<br />
 <br />
+extern const char * const vmstat_text[];<br />
+<br />
 static ssize_t node_read_vmstat(struct sys_device *dev,<br />
 				struct sysdev_attribute *attr, char *buf)<br />
 {<br />
 	int nid = dev-&gt;id;<br />
-	return sprintf(buf,<br />
-		&quot;nr_written %lu\n&quot;<br />
-		&quot;nr_dirtied %lu\n&quot;,<br />
-		node_page_state(nid, NR_WRITTEN),<br />
-		node_page_state(nid, NR_DIRTIED));<br />
+	int i;<br />
+	int n = 0;<br />
+<br />
+	for (i = 0; i &lt; NR_VM_ZONE_STAT_ITEMS; i++)<br />
+		n += sprintf(buf+n, &quot;%s %lu\n&quot;, vmstat_text<i>,<br />
+			     node_page_state(nid, i));<br />
+<br />
+	return n;<br />
 }<br />
 static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL);<br />
 <br />
diff --git a/mm/vmstat.c b/mm/vmstat.c<br />
index 897ea9e..0000aad 100644<br />
--- a/mm/vmstat.c<br />
+++ b/mm/vmstat.c<br />
@@ -852,7 +852,7 @@ static const struct file_operations pagetypeinfo_file_ops = {<br />
 #define TEXTS_FOR_ZONES(xx) TEXT_FOR_DMA(xx) TEXT_FOR_DMA32(xx) xx &quot;_normal&quot;, \<br />
 					TEXT_FOR_HIGHMEM(xx) xx &quot;_movable&quot;,<br />
 <br />
-static const char * const vmstat_text[] = {<br />
+const char * const vmstat_text[] = {<br />
 	/* Zoned VM counters */<br />
 	&quot;nr_free_pages&quot;,<br />
 	&quot;nr_inactive_anon&quot;,<br />
-- <br />
1.7.3.1<br />
<br />
<br />
<br />
--<br />
To unsubscribe from this list: send the line &quot;unsubscribe linux-kernel&quot; in<br />
the body of a message to <a href="mailto:&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;">&#109;&#97;&#106;&#111;&#114;&#100;&#111;&#109;&#111;&#64;&#118;&#103;&#101;&#114;&#46;&#107;&#101;&#114;&#110;&#101;&#108;&#46;&#111;&#114;&#103;</a><br />
More majordomo info at  [<a href="http://vger.kernel.org/majordomo-info.html"  rel="nofollow">vger.kernel.org</a>]<br />
Please read the FAQ at  [<a href="http://www.tux.org/lkml/"  rel="nofollow">www.tux.org</a>]</i>]]></description>
            <dc:creator>KOSAKI Motohiro</dc:creator>
            <category>Linux Kernel</category>
            <pubDate>Mon, 11 Apr 2011 19:11:02 +0800</pubDate>
        </item>
    </channel>
</rss>
