• Michael Rubin's avatar
    mm: add account_page_writeback() · f629d1c9
    Michael Rubin authored
    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
    
    This patch:
    
    This allows code outside of the mm core to safely manipulate page
    writeback state and not worry about the other accounting.  Not using these
    routines means that some code will lose track of the accounting and we get
    bugs.
    
    Modify nilfs2 to use interface.
    Signed-off-by: default avatarMichael Rubin <mrubin@google.com>
    Reviewed-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Reviewed-by: default avatarWu Fengguang <fengguang.wu@intel.com>
    Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
    Cc: Jiro SEKIBA <jir@unicus.jp>
    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: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    f629d1c9
page-writeback.c 39.1 KB