Commit ea941f0e2a8c02ae876cd73deb4e1557248f258c

Authored by Michael Rubin
Committed by Linus Torvalds
1 parent f629d1c9bd

writeback: add nr_dirtied and nr_written to /proc/vmstat

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>
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>

Showing 3 changed files with 7 additions and 0 deletions Side-by-side Diff

include/linux/mmzone.h
... ... @@ -104,6 +104,8 @@
104 104 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */
105 105 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */
106 106 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */
  107 + NR_DIRTIED, /* page dirtyings since bootup */
  108 + NR_WRITTEN, /* page writings since bootup */
107 109 #ifdef CONFIG_NUMA
108 110 NUMA_HIT, /* allocated in intended node */
109 111 NUMA_MISS, /* allocated in non intended node */
... ... @@ -1121,6 +1121,7 @@
1121 1121 {
1122 1122 if (mapping_cap_account_dirty(mapping)) {
1123 1123 __inc_zone_page_state(page, NR_FILE_DIRTY);
  1124 + __inc_zone_page_state(page, NR_DIRTIED);
1124 1125 __inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
1125 1126 task_dirty_inc(current);
1126 1127 task_io_account_write(PAGE_CACHE_SIZE);
... ... @@ -1136,6 +1137,7 @@
1136 1137 void account_page_writeback(struct page *page)
1137 1138 {
1138 1139 inc_zone_page_state(page, NR_WRITEBACK);
  1140 + inc_zone_page_state(page, NR_WRITTEN);
1139 1141 }
1140 1142 EXPORT_SYMBOL(account_page_writeback);
1141 1143  
... ... @@ -745,6 +745,9 @@
745 745 "nr_isolated_anon",
746 746 "nr_isolated_file",
747 747 "nr_shmem",
  748 + "nr_dirtied",
  749 + "nr_written",
  750 +
748 751 #ifdef CONFIG_NUMA
749 752 "numa_hit",
750 753 "numa_miss",