linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat
  2010-09-12 20:30 [PATCH 0/5] writeback: kernel visibility Michael Rubin
@ 2010-09-12 20:30 ` Michael Rubin
  2010-09-13  2:58   ` Wu Fengguang
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Rubin @ 2010-09-12 20:30 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-mm
  Cc: fengguang.wu, jack, riel, akpm, david, kosaki.motohiro, npiggin,
	hch, axboe, Michael Rubin

To help developers and applications gain visibility into writeback
behaviour adding two entries to vm_stat_items and /proc/vmstat. This
will allow us to track the "written" and "dirtied" counts.

   # grep nr_dirtied /proc/vmstat
   nr_dirtied 3747
   # grep nr_written /proc/vmstat
   nr_cleaned 3618

Signed-off-by: Michael Rubin <mrubin@google.com>
---
 include/linux/mmzone.h |    2 ++
 mm/page-writeback.c    |    2 ++
 mm/vmstat.c            |    3 +++
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 6e6e626..d0d7454 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -104,6 +104,8 @@ enum zone_stat_item {
 	NR_ISOLATED_ANON,	/* Temporary isolated pages from anon lru */
 	NR_ISOLATED_FILE,	/* Temporary isolated pages from file lru */
 	NR_SHMEM,		/* shmem pages (included tmpfs/GEM pages) */
+	NR_FILE_DIRTIED,	/* accumulated dirty pages */
+	NR_WRITTEN,		/* accumulated written pages */
 #ifdef CONFIG_NUMA
 	NUMA_HIT,		/* allocated in intended node */
 	NUMA_MISS,		/* allocated in non intended node */
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index ae5f5d5..4d6ef9c 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1126,6 +1126,7 @@ void account_page_dirtied(struct page *page, struct address_space *mapping)
 {
 	if (mapping_cap_account_dirty(mapping)) {
 		__inc_zone_page_state(page, NR_FILE_DIRTY);
+		__inc_zone_page_state(page, NR_FILE_DIRTIED);
 		__inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
 		task_dirty_inc(current);
 		task_io_account_write(PAGE_CACHE_SIZE);
@@ -1141,6 +1142,7 @@ EXPORT_SYMBOL(account_page_dirtied);
 void account_page_writeback(struct page *page)
 {
 	inc_zone_page_state(page, NR_WRITEBACK);
+	inc_zone_page_state(page, NR_WRITTEN);
 }
 EXPORT_SYMBOL(account_page_writeback);
 
diff --git a/mm/vmstat.c b/mm/vmstat.c
index f389168..d448ef4 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -732,6 +732,9 @@ static const char * const vmstat_text[] = {
 	"nr_isolated_anon",
 	"nr_isolated_file",
 	"nr_shmem",
+	"nr_dirtied",
+	"nr_written",
+
 #ifdef CONFIG_NUMA
 	"numa_hit",
 	"numa_miss",
-- 
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat
  2010-09-12 20:30 ` [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat Michael Rubin
@ 2010-09-13  2:58   ` Wu Fengguang
  0 siblings, 0 replies; 8+ messages in thread
From: Wu Fengguang @ 2010-09-13  2:58 UTC (permalink / raw)
  To: Michael Rubin
  Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org, jack@suse.cz, riel@redhat.com,
	akpm@linux-foundation.org, david@fromorbit.com,
	kosaki.motohiro@jp.fujitsu.com, npiggin@kernel.dk, hch@lst.de,
	axboe@kernel.dk

On Mon, Sep 13, 2010 at 04:30:38AM +0800, Michael Rubin wrote:
> To help developers and applications gain visibility into writeback
> behaviour adding two entries to vm_stat_items and /proc/vmstat. This
> will allow us to track the "written" and "dirtied" counts.
> 
>    # grep nr_dirtied /proc/vmstat
>    nr_dirtied 3747
>    # grep nr_written /proc/vmstat
>    nr_cleaned 3618

s/nr_cleaned/nr_written

Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat
  2010-09-13  5:58 [PATCH 0/5] writeback: kernel visibility Michael Rubin
@ 2010-09-13  5:58 ` Michael Rubin
  2010-09-13 21:20   ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Rubin @ 2010-09-13  5:58 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-mm
  Cc: fengguang.wu, jack, riel, akpm, david, kosaki.motohiro, npiggin,
	hch, axboe, Michael Rubin

To help developers and applications gain visibility into writeback
behaviour adding two entries to vm_stat_items and /proc/vmstat. This
will allow us to track the "written" and "dirtied" counts.

   # grep nr_dirtied /proc/vmstat
   nr_dirtied 3747
   # grep nr_written /proc/vmstat
   nr_written 3618

Signed-off-by: Michael Rubin <mrubin@google.com>
Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
---
 include/linux/mmzone.h |    2 ++
 mm/page-writeback.c    |    2 ++
 mm/vmstat.c            |    3 +++
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 6e6e626..d0d7454 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -104,6 +104,8 @@ enum zone_stat_item {
 	NR_ISOLATED_ANON,	/* Temporary isolated pages from anon lru */
 	NR_ISOLATED_FILE,	/* Temporary isolated pages from file lru */
 	NR_SHMEM,		/* shmem pages (included tmpfs/GEM pages) */
+	NR_FILE_DIRTIED,	/* accumulated dirty pages */
+	NR_WRITTEN,		/* accumulated written pages */
 #ifdef CONFIG_NUMA
 	NUMA_HIT,		/* allocated in intended node */
 	NUMA_MISS,		/* allocated in non intended node */
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index ae5f5d5..4d6ef9c 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1126,6 +1126,7 @@ void account_page_dirtied(struct page *page, struct address_space *mapping)
 {
 	if (mapping_cap_account_dirty(mapping)) {
 		__inc_zone_page_state(page, NR_FILE_DIRTY);
+		__inc_zone_page_state(page, NR_FILE_DIRTIED);
 		__inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
 		task_dirty_inc(current);
 		task_io_account_write(PAGE_CACHE_SIZE);
@@ -1141,6 +1142,7 @@ EXPORT_SYMBOL(account_page_dirtied);
 void account_page_writeback(struct page *page)
 {
 	inc_zone_page_state(page, NR_WRITEBACK);
+	inc_zone_page_state(page, NR_WRITTEN);
 }
 EXPORT_SYMBOL(account_page_writeback);
 
diff --git a/mm/vmstat.c b/mm/vmstat.c
index f389168..d448ef4 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -732,6 +732,9 @@ static const char * const vmstat_text[] = {
 	"nr_isolated_anon",
 	"nr_isolated_file",
 	"nr_shmem",
+	"nr_dirtied",
+	"nr_written",
+
 #ifdef CONFIG_NUMA
 	"numa_hit",
 	"numa_miss",
-- 
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat
  2010-09-13  5:58 ` [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat Michael Rubin
@ 2010-09-13 21:20   ` Andrew Morton
  2010-09-13 22:17     ` Michael Rubin
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2010-09-13 21:20 UTC (permalink / raw)
  To: Michael Rubin
  Cc: linux-kernel, linux-fsdevel, linux-mm, fengguang.wu, jack, riel,
	david, kosaki.motohiro, npiggin, hch, axboe

On Sun, 12 Sep 2010 22:58:11 -0700
Michael Rubin <mrubin@google.com> wrote:

> To help developers and applications gain visibility into writeback
> behaviour adding two entries to vm_stat_items and /proc/vmstat. This
> will allow us to track the "written" and "dirtied" counts.
> 
>    # grep nr_dirtied /proc/vmstat
>    nr_dirtied 3747
>    # grep nr_written /proc/vmstat
>    nr_written 3618
> 
> Signed-off-by: Michael Rubin <mrubin@google.com>
> Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
> ---
>  include/linux/mmzone.h |    2 ++
>  mm/page-writeback.c    |    2 ++
>  mm/vmstat.c            |    3 +++
>  3 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 6e6e626..d0d7454 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -104,6 +104,8 @@ enum zone_stat_item {
>  	NR_ISOLATED_ANON,	/* Temporary isolated pages from anon lru */
>  	NR_ISOLATED_FILE,	/* Temporary isolated pages from file lru */
>  	NR_SHMEM,		/* shmem pages (included tmpfs/GEM pages) */
> +	NR_FILE_DIRTIED,	/* accumulated dirty pages */
> +	NR_WRITTEN,		/* accumulated written pages */

I think we can make those comments less ambiguous>

--- a/include/linux/mmzone.h
+++ a/include/linux/mmzone.h
@@ -104,8 +104,8 @@ enum zone_stat_item {
 	NR_ISOLATED_ANON,	/* Temporary isolated pages from anon lru */
 	NR_ISOLATED_FILE,	/* Temporary isolated pages from file lru */
 	NR_SHMEM,		/* shmem pages (included tmpfs/GEM pages) */
-	NR_FILE_DIRTIED,	/* accumulated dirty pages */
-	NR_WRITTEN,		/* accumulated written pages */
+	NR_FILE_DIRTIED,	/* page dirtyings since bootup */
+	NR_WRITTEN,		/* page writings since bootup */
 #ifdef CONFIG_NUMA
 	NUMA_HIT,		/* allocated in intended node */
 	NUMA_MISS,		/* allocated in non intended node */

>
> ...
>
> index f389168..d448ef4 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -732,6 +732,9 @@ static const char * const vmstat_text[] = {
>  	"nr_isolated_anon",
>  	"nr_isolated_file",
>  	"nr_shmem",
> +	"nr_dirtied",
> +	"nr_written",
> +

The mismatch between "NR_FILE_DIRTIED" and "nr_dirtied" is a bit, umm,
dirty.  I can kinda see the logic in the naming but still..

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat
  2010-09-13 21:20   ` Andrew Morton
@ 2010-09-13 22:17     ` Michael Rubin
  2010-09-15  5:23       ` Michael Rubin
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Rubin @ 2010-09-13 22:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-fsdevel, linux-mm, fengguang.wu, jack, riel,
	david, kosaki.motohiro, npiggin, hch, axboe

On Mon, Sep 13, 2010 at 2:20 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Sun, 12 Sep 2010 22:58:11 -0700
> Michael Rubin <mrubin@google.com> wrote:
>
>> To help developers and applications gain visibility into writeback
>> behaviour adding two entries to vm_stat_items and /proc/vmstat. This
>> will allow us to track the "written" and "dirtied" counts.
>>
>>    # grep nr_dirtied /proc/vmstat
>>    nr_dirtied 3747
>>    # grep nr_written /proc/vmstat
>>    nr_written 3618
>>
>> Signed-off-by: Michael Rubin <mrubin@google.com>
>> Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
>> ---
>>  include/linux/mmzone.h |    2 ++
>>  mm/page-writeback.c    |    2 ++
>>  mm/vmstat.c            |    3 +++
>>  3 files changed, 7 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
>> index 6e6e626..d0d7454 100644
>> --- a/include/linux/mmzone.h
>> +++ b/include/linux/mmzone.h
>> @@ -104,6 +104,8 @@ enum zone_stat_item {
>>       NR_ISOLATED_ANON,       /* Temporary isolated pages from anon lru */
>>       NR_ISOLATED_FILE,       /* Temporary isolated pages from file lru */
>>       NR_SHMEM,               /* shmem pages (included tmpfs/GEM pages) */
>> +     NR_FILE_DIRTIED,        /* accumulated dirty pages */
>> +     NR_WRITTEN,             /* accumulated written pages */
>
> I think we can make those comments less ambiguous>
>
> --- a/include/linux/mmzone.h
> +++ a/include/linux/mmzone.h
> @@ -104,8 +104,8 @@ enum zone_stat_item {
>        NR_ISOLATED_ANON,       /* Temporary isolated pages from anon lru */
>        NR_ISOLATED_FILE,       /* Temporary isolated pages from file lru */
>        NR_SHMEM,               /* shmem pages (included tmpfs/GEM pages) */
> -       NR_FILE_DIRTIED,        /* accumulated dirty pages */
> -       NR_WRITTEN,             /* accumulated written pages */
> +       NR_FILE_DIRTIED,        /* page dirtyings since bootup */
> +       NR_WRITTEN,             /* page writings since bootup */

Got it. Will fix.

> The mismatch between "NR_FILE_DIRTIED" and "nr_dirtied" is a bit, umm,
> dirty.  I can kinda see the logic in the naming but still..

Got it will fix.

mrubin

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat
  2010-09-13 22:17     ` Michael Rubin
@ 2010-09-15  5:23       ` Michael Rubin
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Rubin @ 2010-09-15  5:23 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-fsdevel, linux-mm, fengguang.wu, jack, riel,
	david, kosaki.motohiro, npiggin, hch, axboe

I know it's been applied but in case you want minor nits fixed. I am
sending one more update.

mrubin

On Mon, Sep 13, 2010 at 3:17 PM, Michael Rubin <mrubin@google.com> wrote:
> On Mon, Sep 13, 2010 at 2:20 PM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
>> On Sun, 12 Sep 2010 22:58:11 -0700
>> Michael Rubin <mrubin@google.com> wrote:
>>
>>> To help developers and applications gain visibility into writeback
>>> behaviour adding two entries to vm_stat_items and /proc/vmstat. This
>>> will allow us to track the "written" and "dirtied" counts.
>>>
>>>    # grep nr_dirtied /proc/vmstat
>>>    nr_dirtied 3747
>>>    # grep nr_written /proc/vmstat
>>>    nr_written 3618
>>>
>>> Signed-off-by: Michael Rubin <mrubin@google.com>
>>> Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
>>> ---
>>>  include/linux/mmzone.h |    2 ++
>>>  mm/page-writeback.c    |    2 ++
>>>  mm/vmstat.c            |    3 +++
>>>  3 files changed, 7 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
>>> index 6e6e626..d0d7454 100644
>>> --- a/include/linux/mmzone.h
>>> +++ b/include/linux/mmzone.h
>>> @@ -104,6 +104,8 @@ enum zone_stat_item {
>>>       NR_ISOLATED_ANON,       /* Temporary isolated pages from anon lru */
>>>       NR_ISOLATED_FILE,       /* Temporary isolated pages from file lru */
>>>       NR_SHMEM,               /* shmem pages (included tmpfs/GEM pages) */
>>> +     NR_FILE_DIRTIED,        /* accumulated dirty pages */
>>> +     NR_WRITTEN,             /* accumulated written pages */
>>
>> I think we can make those comments less ambiguous>
>>
>> --- a/include/linux/mmzone.h
>> +++ a/include/linux/mmzone.h
>> @@ -104,8 +104,8 @@ enum zone_stat_item {
>>        NR_ISOLATED_ANON,       /* Temporary isolated pages from anon lru */
>>        NR_ISOLATED_FILE,       /* Temporary isolated pages from file lru */
>>        NR_SHMEM,               /* shmem pages (included tmpfs/GEM pages) */
>> -       NR_FILE_DIRTIED,        /* accumulated dirty pages */
>> -       NR_WRITTEN,             /* accumulated written pages */
>> +       NR_FILE_DIRTIED,        /* page dirtyings since bootup */
>> +       NR_WRITTEN,             /* page writings since bootup */
>
> Got it. Will fix.
>
>> The mismatch between "NR_FILE_DIRTIED" and "nr_dirtied" is a bit, umm,
>> dirty.  I can kinda see the logic in the naming but still..
>
> Got it will fix.
>
> mrubin
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat
@ 2010-09-15  6:08 Michael Rubin
  2010-09-15  6:08 ` [PATCH 4/5] writeback: Adding /sys/devices/system/node/<node>/vmstat Michael Rubin
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Rubin @ 2010-09-15  6:08 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-mm
  Cc: fengguang.wu, jack, riel, akpm, david, kosaki.motohiro, npiggin,
	hch, axboe, Michael Rubin

To help developers and applications gain visibility into writeback
behaviour adding two entries to vm_stat_items and /proc/vmstat. This
will allow us to track the "written" and "dirtied" counts.

   # grep nr_dirtied /proc/vmstat
   nr_dirtied 3747
   # grep nr_written /proc/vmstat
   nr_written 3618

Signed-off-by: Michael Rubin <mrubin@google.com>
---
 include/linux/mmzone.h |    2 ++
 mm/page-writeback.c    |    2 ++
 mm/vmstat.c            |    3 +++
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 6e6e626..bd6c7fc 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -104,6 +104,8 @@ enum zone_stat_item {
 	NR_ISOLATED_ANON,	/* Temporary isolated pages from anon lru */
 	NR_ISOLATED_FILE,	/* Temporary isolated pages from file lru */
 	NR_SHMEM,		/* shmem pages (included tmpfs/GEM pages) */
+	NR_DIRTIED,		/* page dirtyings since bootup */
+	NR_WRITTEN,		/* page writings since bootup */
 #ifdef CONFIG_NUMA
 	NUMA_HIT,		/* allocated in intended node */
 	NUMA_MISS,		/* allocated in non intended node */
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index ae5f5d5..79feaa0 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1126,6 +1126,7 @@ void account_page_dirtied(struct page *page, struct address_space *mapping)
 {
 	if (mapping_cap_account_dirty(mapping)) {
 		__inc_zone_page_state(page, NR_FILE_DIRTY);
+		__inc_zone_page_state(page, NR_DIRTIED);
 		__inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
 		task_dirty_inc(current);
 		task_io_account_write(PAGE_CACHE_SIZE);
@@ -1141,6 +1142,7 @@ EXPORT_SYMBOL(account_page_dirtied);
 void account_page_writeback(struct page *page)
 {
 	inc_zone_page_state(page, NR_WRITEBACK);
+	inc_zone_page_state(page, NR_WRITTEN);
 }
 EXPORT_SYMBOL(account_page_writeback);
 
diff --git a/mm/vmstat.c b/mm/vmstat.c
index f389168..d448ef4 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -732,6 +732,9 @@ static const char * const vmstat_text[] = {
 	"nr_isolated_anon",
 	"nr_isolated_file",
 	"nr_shmem",
+	"nr_dirtied",
+	"nr_written",
+
 #ifdef CONFIG_NUMA
 	"numa_hit",
 	"numa_miss",
-- 
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/5] writeback: Adding /sys/devices/system/node/<node>/vmstat
  2010-09-15  6:08 [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat Michael Rubin
@ 2010-09-15  6:08 ` Michael Rubin
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Rubin @ 2010-09-15  6:08 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-mm
  Cc: fengguang.wu, jack, riel, akpm, david, kosaki.motohiro, npiggin,
	hch, axboe, Michael Rubin

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>
---
 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 2872e86..2832ebd 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,
 }
 static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
 
+static ssize_t node_read_vmstat(struct sys_device *dev,
+				struct sysdev_attribute *attr, char *buf)
+{
+	int nid = dev->id;
+	return sprintf(buf,
+		"nr_written %lu\n"
+		"nr_dirtied %lu\n",
+		node_page_state(nid, NR_WRITTEN),
+		node_page_state(nid, NR_DIRTIED));
+}
+static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL);
+
 static ssize_t node_read_distance(struct sys_device * dev,
 			struct sysdev_attribute *attr, char * buf)
 {
@@ -243,6 +255,7 @@ 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);
+		sysdev_create_file(&node->sysdev, &attr_vmstat);
 
 		scan_unevictable_register_node(node);
 
@@ -267,6 +280,7 @@ 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);
+	sysdev_remove_file(&node->sysdev, &attr_vmstat);
 
 	scan_unevictable_unregister_node(node);
 	hugetlb_unregister_node(node);		/* no-op, if memoryless node */
-- 
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-09-15  6:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15  6:08 [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat Michael Rubin
2010-09-15  6:08 ` [PATCH 4/5] writeback: Adding /sys/devices/system/node/<node>/vmstat Michael Rubin
  -- strict thread matches above, loose matches on Subject: below --
2010-09-13  5:58 [PATCH 0/5] writeback: kernel visibility Michael Rubin
2010-09-13  5:58 ` [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat Michael Rubin
2010-09-13 21:20   ` Andrew Morton
2010-09-13 22:17     ` Michael Rubin
2010-09-15  5:23       ` Michael Rubin
2010-09-12 20:30 [PATCH 0/5] writeback: kernel visibility Michael Rubin
2010-09-12 20:30 ` [PATCH 3/5] writeback: nr_dirtied and nr_written in /proc/vmstat Michael Rubin
2010-09-13  2:58   ` Wu Fengguang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).