lkml.org 
[lkml]   [2006]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 18/32] readahead: initial method - thrashing guard size
    backing_dev_info.ra_thrash_bytes is dynamicly updated to be a little above
    the thrashing safe read-ahead size. It is used in the initial method where
    the thrashing threshold for the particular reader is still unknown.

    Signed-off-by: Wu Fengguang <wfg@mail.ustc.edu.cn>
    ---

    mm/readahead.c | 20 ++++++++++++++++++++
    1 files changed, 20 insertions(+)

    --- linux-2.6.17-rc4-mm3.orig/mm/readahead.c
    +++ linux-2.6.17-rc4-mm3/mm/readahead.c
    @@ -796,6 +796,22 @@ out:
    }

    /*
    + * Update `backing_dev_info.ra_thrash_bytes' to be a _biased_ average of
    + * read-ahead sizes. Which makes it an a-bit-risky(*) estimation of the
    + * _minimal_ read-ahead thrashing threshold on the device.
    + *
    + * (*) Note that being a bit risky can _help_ overall performance.
    + */
    +static inline void update_ra_thrash_bytes(struct backing_dev_info *bdi,
    + unsigned long ra_size)
    +{
    + ra_size <<= PAGE_CACHE_SHIFT;
    + bdi->ra_thrash_bytes = (bdi->ra_thrash_bytes < ra_size) ?
    + (ra_size + bdi->ra_thrash_bytes * 1023) / 1024:
    + (ra_size + bdi->ra_thrash_bytes * 7) / 8;
    +}
    +
    +/*
    * The node's accumulated aging activities.
    */
    static unsigned long node_readahead_aging(void)
    @@ -1144,6 +1160,10 @@ state_based_readahead(struct address_spa
    if (!adjust_rala(growth_limit, &ra_size, &la_size))
    return 0;

    + /* ra_size in its _steady_ state reflects thrashing threshold */
    + if (page && ra_old + ra_old / 8 >= ra_size)
    + update_ra_thrash_bytes(mapping->backing_dev_info, ra_size);
    +
    ra_set_class(ra, RA_CLASS_STATE);
    ra_set_index(ra, index, ra->readahead_index);
    ra_set_size(ra, ra_size, la_size);
    --
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-05-27 17:58    [W:4.125 / U:0.444 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site