lkml.org 
[lkml]   [2010]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 7/8] writeback: sync old inodes first in background writeback
    Date
    From: Wu Fengguang <fengguang.wu@intel.com>

    A background flush work may run for ever. So it's reasonable for it to
    mimic the kupdate behavior of syncing old/expired inodes first.

    This behavior also makes sense from the perspective of page reclaim.
    File pages are added to the inactive list and promoted if referenced
    after one recycling. If not referenced, it's very easy for pages to be
    cleaned from reclaim context which is inefficient in terms of IO. If
    background flush is cleaning pages, it's best it cleans old pages to
    help minimise IO from reclaim.

    Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
    Signed-off-by: Mel Gorman <mel@csn.ul.ie>
    ---
    fs/fs-writeback.c | 19 ++++++++++++++++---
    1 files changed, 16 insertions(+), 3 deletions(-)

    diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
    index d5be169..cc81c67 100644
    --- a/fs/fs-writeback.c
    +++ b/fs/fs-writeback.c
    @@ -612,13 +612,14 @@ static long wb_writeback(struct bdi_writeback *wb,
    .range_cyclic = work->range_cyclic,
    };
    unsigned long oldest_jif;
    + int expire_interval = msecs_to_jiffies(dirty_expire_interval * 10);
    + int fg_rounds = 0;
    long wrote = 0;
    struct inode *inode;

    - if (wbc.for_kupdate) {
    + if (wbc.for_kupdate || wbc.for_background) {
    wbc.older_than_this = &oldest_jif;
    - oldest_jif = jiffies -
    - msecs_to_jiffies(dirty_expire_interval * 10);
    + oldest_jif = jiffies - expire_interval;
    }
    if (!wbc.range_cyclic) {
    wbc.range_start = 0;
    @@ -649,6 +650,18 @@ static long wb_writeback(struct bdi_writeback *wb,
    work->nr_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
    wrote += MAX_WRITEBACK_PAGES - wbc.nr_to_write;

    + if (work->for_background && expire_interval &&
    + ++fg_rounds && list_empty(&wb->b_io)) {
    + if (fg_rounds < 10)
    + expire_interval >>= 1;
    + if (expire_interval)
    + oldest_jif = jiffies - expire_interval;
    + else
    + wbc.older_than_this = 0;
    + fg_rounds = 0;
    + continue;
    + }
    +
    /*
    * If we consumed everything, see if we have more
    */
    --
    1.7.1


    \
     
     \ /
      Last update: 2010-07-19 15:15    [W:4.108 / U:0.156 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site