lkml.org 
[lkml]   [2010]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 33/47] writeback: trace global dirty page states
    Add trace balance_dirty_state for showing the global dirty page counts
    and thresholds at each balance_dirty_pages() loop.

    Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
    ---
    include/trace/events/writeback.h | 57 +++++++++++++++++++++++++++++
    mm/page-writeback.c | 15 ++++++-
    2 files changed, 69 insertions(+), 3 deletions(-)

    --- linux-next.orig/mm/page-writeback.c 2010-12-09 12:24:49.000000000 +0800
    +++ linux-next/mm/page-writeback.c 2010-12-09 12:24:52.000000000 +0800
    @@ -720,12 +720,21 @@ static void balance_dirty_pages(struct a
    * written to the server's write cache, but has not yet
    * been flushed to permanent storage.
    */
    - nr_reclaimable = global_page_state(NR_FILE_DIRTY) +
    - global_page_state(NR_UNSTABLE_NFS);
    - nr_dirty = nr_reclaimable + global_page_state(NR_WRITEBACK);
    + nr_reclaimable = global_page_state(NR_FILE_DIRTY);
    + bdi_dirty = global_page_state(NR_UNSTABLE_NFS);
    + nr_dirty = global_page_state(NR_WRITEBACK);

    global_dirty_limits(&background_thresh, &dirty_thresh);

    + trace_balance_dirty_state(mapping,
    + nr_reclaimable,
    + nr_dirty,
    + bdi_dirty,
    + background_thresh,
    + dirty_thresh);
    + nr_reclaimable += bdi_dirty;
    + nr_dirty += nr_reclaimable;
    +
    /*
    * Throttle it only when the background writeback cannot
    * catch-up. This avoids (excessively) small writeouts
    --- linux-next.orig/include/trace/events/writeback.h 2010-12-09 12:24:49.000000000 +0800
    +++ linux-next/include/trace/events/writeback.h 2010-12-09 12:24:52.000000000 +0800
    @@ -149,6 +149,63 @@ DEFINE_WBC_EVENT(wbc_writeback_written);
    DEFINE_WBC_EVENT(wbc_writeback_wait);
    DEFINE_WBC_EVENT(wbc_writepage);

    +TRACE_EVENT(balance_dirty_state,
    +
    + TP_PROTO(struct address_space *mapping,
    + unsigned long nr_dirty,
    + unsigned long nr_writeback,
    + unsigned long nr_unstable,
    + unsigned long background_thresh,
    + unsigned long dirty_thresh
    + ),
    +
    + TP_ARGS(mapping,
    + nr_dirty,
    + nr_writeback,
    + nr_unstable,
    + background_thresh,
    + dirty_thresh
    + ),
    +
    + TP_STRUCT__entry(
    + __array(char, bdi, 32)
    + __field(unsigned long, ino)
    + __field(unsigned long, nr_dirty)
    + __field(unsigned long, nr_writeback)
    + __field(unsigned long, nr_unstable)
    + __field(unsigned long, background_thresh)
    + __field(unsigned long, dirty_thresh)
    + __field(unsigned long, task_dirtied_pause)
    + ),
    +
    + TP_fast_assign(
    + strlcpy(__entry->bdi,
    + dev_name(mapping->backing_dev_info->dev), 32);
    + __entry->ino = mapping->host->i_ino;
    + __entry->nr_dirty = nr_dirty;
    + __entry->nr_writeback = nr_writeback;
    + __entry->nr_unstable = nr_unstable;
    + __entry->background_thresh = background_thresh;
    + __entry->dirty_thresh = dirty_thresh;
    + __entry->task_dirtied_pause = current->nr_dirtied_pause;
    + ),
    +
    + TP_printk("bdi %s: dirty=%lu wb=%lu unstable=%lu "
    + "bg_thresh=%lu thresh=%lu gap=%ld "
    + "poll_thresh=%lu ino=%lu",
    + __entry->bdi,
    + __entry->nr_dirty,
    + __entry->nr_writeback,
    + __entry->nr_unstable,
    + __entry->background_thresh,
    + __entry->dirty_thresh,
    + __entry->dirty_thresh - __entry->nr_dirty -
    + __entry->nr_writeback - __entry->nr_unstable,
    + __entry->task_dirtied_pause,
    + __entry->ino
    + )
    +);
    +
    #define KBps(x) ((x) << (PAGE_SHIFT - 10))
    #define BDP_PERCENT(a, b, c) ((__entry->a - __entry->b) * 100 * c + \
    __entry->bdi_limit/2) / (__entry->bdi_limit|1)



    \
     
     \ /
      Last update: 2010-12-13 07:59    [W:0.028 / U:0.232 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site