The patch titled readahead: thrashing recovery method has been added to the -mm tree. Its filename is readahead-thrashing-recovery-method.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: readahead: thrashing recovery method From: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx> Readahead policy after thrashing. It tries to recover gracefully from the thrashing. Signed-off-by: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- mm/readahead.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+) diff -puN mm/readahead.c~readahead-thrashing-recovery-method mm/readahead.c --- a/mm/readahead.c~readahead-thrashing-recovery-method +++ a/mm/readahead.c @@ -1487,6 +1487,50 @@ try_backward_prefetching(struct file_ra_ } /* + * Readahead thrashing recovery. + */ +static unsigned long +thrashing_recovery_readahead(struct address_space *mapping, + struct file *filp, struct file_ra_state *ra, + pgoff_t offset, unsigned long ra_max) +{ + unsigned long ra_size; + +#ifdef CONFIG_DEBUG_READAHEAD + if (probe_page(mapping, offset - 1)) + ra_account(ra, RA_EVENT_READAHEAD_MUTILATE, + ra->readahead_index - offset); + ra_account(ra, RA_EVENT_READAHEAD_THRASHING, + ra->readahead_index - offset); +#endif + + /* + * Some thrashing occur in (ra_index, la_index], in which case the + * old read-ahead chunk is lost soon after the new one is allocated. + * Ensure that we recover all needed pages in the old chunk. + */ + if (offset < ra->ra_index) + ra_size = ra->ra_index - offset; + else { + /* After thrashing, we know the exact thrashing-threshold. */ + ra_size = offset - ra->ra_index; + update_ra_thrash_bytes(mapping->backing_dev_info, ra_size); + + /* And we'd better be a bit conservative. */ + ra_size = ra_size * 3 / 4; + } + + if (ra_size > ra_max) + ra_size = ra_max; + + ra_set_class(ra, RA_CLASS_THRASHING); + ra_set_index(ra, offset, offset); + ra_set_size(ra, ra_size, ra_size / LOOKAHEAD_RATIO); + + return ra_submit(ra, mapping, filp); +} + +/* * ra_min is mainly determined by the size of cache memory. Reasonable? * * Table of concrete numbers for 4KB page size: _ Patches currently in -mm which might be from wfg@xxxxxxxxxxxxxxxx are readahead-kconfig-options.patch radixtree-introduce-scan-hole-data-functions.patch mm-introduce-probe_page.patch mm-introduce-pg_readahead.patch readahead-add-look-ahead-support-to-__do_page_cache_readahead.patch readahead-insert-cond_resched-calls.patch readahead-minmax_ra_pages.patch readahead-events-accounting.patch readahead-rescue_pages.patch readahead-sysctl-parameters.patch readahead-min-max-sizes.patch readahead-state-based-method-aging-accounting.patch readahead-state-based-method-routines.patch readahead-state-based-method.patch readahead-context-based-method.patch readahead-initial-method-guiding-sizes.patch readahead-initial-method-thrashing-guard-size.patch readahead-initial-method-user-recommended-size.patch readahead-initial-method.patch readahead-backward-prefetching-method.patch readahead-thrashing-recovery-method.patch readahead-call-scheme.patch readahead-laptop-mode.patch readahead-loop-case.patch readahead-nfsd-case.patch readahead-turn-on-by-default.patch readahead-remove-size-limit-on-read_ahead_kb.patch readahead-remove-size-limit-of-max_sectors_kb-on-read_ahead_kb.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html