lkml.org 
[lkml]   [2011]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 4/5] writeback: fix dirtied pages accounting on redirty
    De-account the accumulative dirty counters on page redirty.

    Page redirties (very common in ext4) will introduce mismatch between
    counters (a) and (b)

    a) NR_DIRTIED, BDI_DIRTIED, tsk->nr_dirtied
    b) NR_WRITTEN, BDI_WRITTEN

    This will introduce systematic errors in balanced_rate and result in
    dirty page position errors (ie. the dirty pages are no longer balanced
    around the global/bdi setpoints).

    Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
    ---
    include/linux/writeback.h | 2 ++
    mm/page-writeback.c | 12 ++++++++++++
    2 files changed, 14 insertions(+)

    --- linux-next.orig/mm/page-writeback.c 2011-11-17 20:57:15.000000000 +0800
    +++ linux-next/mm/page-writeback.c 2011-11-17 20:57:16.000000000 +0800
    @@ -1792,6 +1792,17 @@ int __set_page_dirty_nobuffers(struct pa
    }
    EXPORT_SYMBOL(__set_page_dirty_nobuffers);

    +void account_page_redirty(struct page *page)
    +{
    + struct address_space *mapping = page->mapping;
    + if (mapping && mapping_cap_account_dirty(mapping)) {
    + current->nr_dirtied--;
    + dec_zone_page_state(page, NR_DIRTIED);
    + dec_bdi_stat(mapping->backing_dev_info, BDI_DIRTIED);
    + }
    +}
    +EXPORT_SYMBOL(account_page_redirty);
    +
    /*
    * When a writepage implementation decides that it doesn't want to write this
    * page for some reason, it should redirty the locked page via
    @@ -1800,6 +1811,7 @@ EXPORT_SYMBOL(__set_page_dirty_nobuffers
    int redirty_page_for_writepage(struct writeback_control *wbc, struct page *page)
    {
    wbc->pages_skipped++;
    + account_page_redirty(page);
    return __set_page_dirty_nobuffers(page);
    }
    EXPORT_SYMBOL(redirty_page_for_writepage);
    --- linux-next.orig/include/linux/writeback.h 2011-11-17 20:57:12.000000000 +0800
    +++ linux-next/include/linux/writeback.h 2011-11-17 20:57:16.000000000 +0800
    @@ -197,6 +197,8 @@ void writeback_set_ratelimit(void);
    void tag_pages_for_writeback(struct address_space *mapping,
    pgoff_t start, pgoff_t end);

    +void account_page_redirty(struct page *page);
    +
    /* pdflush.c */
    extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
    read-only. */



    \
     
     \ /
      Last update: 2011-11-21 14:19    [W:0.039 / U:0.092 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site