The patch titled readahead: backward prefetching method has been added to the -mm tree. Its filename is readahead-backward-prefetching-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: backward prefetching method From: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx> Readahead policy for reading backward. Signed-off-by: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- mm/readahead.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+) diff -puN mm/readahead.c~readahead-backward-prefetching-method mm/readahead.c --- a/mm/readahead.c~readahead-backward-prefetching-method +++ a/mm/readahead.c @@ -1441,6 +1441,52 @@ initial_readahead(struct address_space * } /* + * Backward prefetching. + * + * No look-ahead and thrashing safety guard: should be unnecessary. + * + * Important for certain scientific arenas(i.e. structural analysis). + */ +static int +try_backward_prefetching(struct file_ra_state *ra, pgoff_t offset, + unsigned long size, unsigned long ra_max) +{ + pgoff_t prev = ra->prev_page; + + /* Reading backward? */ + if (offset >= prev) + return 0; + + /* Close enough? */ + size += readahead_hit_rate; + if (offset + 2 * size <= prev) + return 0; + + if (ra_class_new(ra) == RA_CLASS_BACKWARD && ra_has_index(ra, prev)) { + prev = ra->la_index; + size += 2 * ra_readahead_size(ra); + } else + size *= 2; + + if (size > ra_max) + size = ra_max; + if (size > prev) + size = prev; + + /* The readahead-request covers the read-request? */ + if (offset < prev - size) + return 0; + + offset = prev - size; + + ra_set_class(ra, RA_CLASS_BACKWARD); + ra_set_index(ra, offset, offset); + ra_set_size(ra, size, 0); + + return 1; +} + +/* * 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