All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] writeback: kernel visibility
@ 2010-09-13  5:58 ` Michael Rubin
  0 siblings, 0 replies; 28+ 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

Patch #1 sets up some helper functions for account_page_dirty and fixes
a bug in ceph

Patch #2 sets up some helper functions for account_page_writeback

Patch #3 adds writeback visibility in /proc/vmstat

To help developers and applications gain visibility into writeback
behaviour this patch adds two counters to /proc/vmstat.

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

These entries allow user apps to understand writeback behaviour over
time and learn how it is impacting their performance. Currently there
is no way to inspect dirty and writeback speed over time. It's not
possible for nr_dirty/nr_writeback.

These entries are necessary to give visibility into writeback
behaviour. We have /proc/diskstats which lets us understand the io in
the block layer. We have blktrace for more in depth understanding. We have
e2fsprogs and debugsfs to give insight into the file systems behaviour,
but we don't offer our users the ability understand what writeback is
doing. There is no way to know how active it is over the whole system,
if it's falling behind or to quantify it's efforts. With these values
exported users can easily see how much data applications are sending
through writeback and also at what rates writeback is processing this
data. Comparing the rates of change between the two allow developers
to see when writeback is not able to keep up with incoming traffic and
the rate of dirty memory being sent to the IO back end. This allows
folks to understand their io workloads and track kernel issues. Non
kernel engineers at Google often use these counters to solve puzzling
performance problems.

Patch #4 adds a pernode vmstat file with nr_dirtied and nr_written

Patch #5 add writeback thresholds to /proc/vmstat

Currently these values are in debugfs. But they should be promoted to
/proc since they are useful for developers who are writing databases
and file servers and are not debugging the kernel.

The output is as below:

 # grep threshold /proc/vmstat
 nr_pages_dirty_threshold 409111
 nr_pages_dirty_background_threshold 818223

Michael Rubin (5):
  mm: exporting account_page_dirty
  mm: account_page_writeback added
  writeback: nr_dirtied and nr_written in /proc/vmstat
  writeback: Adding /sys/devices/system/node/<node>/vmstat
  writeback: Reporting dirty thresholds in /proc/vmstat

 drivers/base/node.c    |   14 ++++++++++++++
 fs/ceph/addr.c         |    8 +-------
 fs/nilfs2/segment.c    |    2 +-
 include/linux/mm.h     |    1 +
 include/linux/mmzone.h |    2 ++
 mm/page-writeback.c    |   16 +++++++++++++++-
 mm/vmstat.c            |   42 ++++++++++++++++++++++++++++--------------
 7 files changed, 62 insertions(+), 23 deletions(-)


^ permalink raw reply	[flat|nested] 28+ 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   ` Michael Rubin
  0 siblings, 1 reply; 28+ 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


^ permalink raw reply related	[flat|nested] 28+ messages in thread
* [PATCH 0/5] writeback: kernel visibility
@ 2010-09-12 20:30 Michael Rubin
  2010-09-12 20:30   ` Michael Rubin
  0 siblings, 1 reply; 28+ 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

Patch #1 sets up some helper functions for account_page_dirty and fixes
a bug in ceph

Patch #2 sets up some helper functions for account_page_writeback

Patch #3 adds writeback visibility in /proc/vmstat

To help developers and applications gain visibility into writeback
behaviour this patch adds two counters to /proc/vmstat.

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

These entries allow user apps to understand writeback behaviour over
time and learn how it is impacting their performance. Currently there
is no way to inspect dirty and writeback speed over time. It's not
possible for nr_dirty/nr_writeback.

These entries are necessary to give visibility into writeback
behaviour. We have /proc/diskstats which lets us understand the io in
the block layer. We have blktrace for more in depth understanding. We have
e2fsprogs and debugsfs to give insight into the file systems behaviour,
but we don't offer our users the ability understand what writeback is
doing. There is no way to know how active it is over the whole system,
if it's falling behind or to quantify it's efforts. With these values
exported users can easily see how much data applications are sending
through writeback and also at what rates writeback is processing this
data. Comparing the rates of change between the two allow developers
to see when writeback is not able to keep up with incoming traffic and
the rate of dirty memory being sent to the IO back end. This allows
folks to understand their io workloads and track kernel issues. Non
kernel engineers at Google often use these counters to solve puzzling
performance problems.

Patch #4 adds a pernode vmstat file with nr_dirtied and nr_written

Patch #5 add writeback thresholds to /proc/vmstat

Currently these values are in debugfs. But they should be promoted to
/proc since they are useful for developers who are writing databases
and file servers and are not debugging the kernel.

The output is as below:

 # grep threshold /proc/vmstat
 nr_pages_dirty_threshold 409111
 nr_pages_dirty_background_threshold 818223

Michael Rubin (5):
  mm: exporting account_page_dirty
  mm: account_page_writeback added
  writeback: nr_dirtied and nr_written in /proc/vmstat
  writeback: Adding /sys/devices/system/node/<node>/vmstat
  writeback: Reporting dirty thresholds in /proc/vmstat

 drivers/base/node.c    |   14 ++++++++++++++
 fs/ceph/addr.c         |    8 +-------
 fs/nilfs2/segment.c    |    2 +-
 include/linux/mm.h     |    1 +
 include/linux/mmzone.h |    4 ++++
 mm/page-writeback.c    |   16 +++++++++++++++-
 mm/vmstat.c            |    7 +++++++
 7 files changed, 43 insertions(+), 9 deletions(-)


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

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

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.