lkml.org 
[lkml]   [2011]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 3/7] writeback: fix dirtied pages accounting on sub-page writes
    When dd in 512bytes, generic_perform_write() calls
    balance_dirty_pages_ratelimited() 8 times for the same page, but
    obviously the page is only dirtied once.

    Fix it by accounting tsk->nr_dirtied and bdp_ratelimits at page dirty time.

    Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
    ---
    mm/page-writeback.c | 13 +++++--------
    1 file changed, 5 insertions(+), 8 deletions(-)

    --- linux-next.orig/mm/page-writeback.c 2011-11-28 21:23:20.000000000 +0800
    +++ linux-next/mm/page-writeback.c 2011-11-28 21:23:23.000000000 +0800
    @@ -1239,8 +1239,6 @@ void balance_dirty_pages_ratelimited_nr(
    if (bdi->dirty_exceeded)
    ratelimit = min(ratelimit, 32 >> (PAGE_SHIFT - 10));

    - current->nr_dirtied += nr_pages_dirtied;
    -
    preempt_disable();
    /*
    * This prevents one CPU to accumulate too many dirtied pages without
    @@ -1251,12 +1249,9 @@ void balance_dirty_pages_ratelimited_nr(
    p = &__get_cpu_var(bdp_ratelimits);
    if (unlikely(current->nr_dirtied >= ratelimit))
    *p = 0;
    - else {
    - *p += nr_pages_dirtied;
    - if (unlikely(*p >= ratelimit_pages)) {
    - *p = 0;
    - ratelimit = 0;
    - }
    + else if (unlikely(*p >= ratelimit_pages)) {
    + *p = 0;
    + ratelimit = 0;
    }
    /*
    * Pick up the dirtied pages by the exited tasks. This avoids lots of
    @@ -1749,6 +1744,8 @@ void account_page_dirtied(struct page *p
    __inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
    __inc_bdi_stat(mapping->backing_dev_info, BDI_DIRTIED);
    task_io_account_write(PAGE_CACHE_SIZE);
    + current->nr_dirtied++;
    + this_cpu_inc(bdp_ratelimits);
    }
    }
    EXPORT_SYMBOL(account_page_dirtied);



    \
     
     \ /
      Last update: 2011-11-28 15:13    [W:6.717 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site