+ readahead-backward-prefetching-method-fix.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     readahead: backward prefetching method fix

has been added to the -mm tree.  Its filename is

     readahead-backward-prefetching-method-fix.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 fix
From: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx>


- The backward prefetching method fails near start of file. Fix it.
- Make it scale up more quickly by adding ra_min to ra_size.
- Do not discount readahead_hit_rate, that's not a documented behavior.

Signed-off-by: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 mm/readahead.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff -puN mm/readahead.c~readahead-backward-prefetching-method-fix mm/readahead.c
--- a/mm/readahead.c~readahead-backward-prefetching-method-fix
+++ a/mm/readahead.c
@@ -1612,8 +1612,9 @@ initial_readahead(struct address_space *
  * Important for certain scientific arenas(i.e. structural analysis).
  */
 static int
-try_read_backward(struct file_ra_state *ra, pgoff_t begin_index,
-			unsigned long ra_size, unsigned long ra_max)
+try_read_backward(struct file_ra_state *ra,
+			pgoff_t begin_index, unsigned long ra_size,
+			unsigned long ra_min, unsigned long ra_max)
 {
 	pgoff_t end_index;
 
@@ -1622,11 +1623,11 @@ try_read_backward(struct file_ra_state *
 		return 0;
 
 	if ((ra->flags & RA_CLASS_MASK) == RA_CLASS_BACKWARD &&
-					ra_has_index(ra, ra->prev_page)) {
-		ra_size += 2 * ra->hit0;
+		ra_has_index(ra, ra->prev_page) && ra_cache_hit_ok(ra)) {
+		ra_size += ra_min + 2 * ra_readahead_size(ra);
 		end_index = ra->la_index;
 	} else {
-		ra_size += ra_size + ra_size * (readahead_hit_rate - 1) / 2;
+		ra_size += ra_size * readahead_hit_rate;
 		end_index = ra->prev_page;
 	}
 
@@ -1637,7 +1638,7 @@ try_read_backward(struct file_ra_state *
 	if (end_index > begin_index + ra_size)
 		return 0;
 
-	begin_index = end_index - ra_size;
+	begin_index = end_index > ra_size ? end_index - ra_size : 0;
 
 	ra_set_class(ra, RA_CLASS_BACKWARD);
 	ra_set_index(ra, begin_index, begin_index);
@@ -1840,7 +1841,7 @@ page_cache_readahead_adaptive(struct add
 	 * Backward read-ahead.
 	 */
 	if (!page && begin_index == index &&
-				try_read_backward(ra, index, size, ra_max))
+				try_read_backward(ra, index, size, ra_min, ra_max))
 		return ra_dispatch(ra, mapping, filp);
 
 	/*
_

Patches currently in -mm which might be from wfg@xxxxxxxxxxxxxxxx are

origin.patch
readahead-kconfig-options.patch
radixtree-introduce-radix_tree_scan_hole.patch
mm-introduce-probe_page.patch
mm-introduce-pg_readahead.patch
readahead-add-look-ahead-support-to-__do_page_cache_readahead.patch
readahead-delay-page-release-in-do_generic_mapping_read.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-sysctl-parameters-fix.patch
readahead-min-max-sizes.patch
readahead-state-based-method-aging-accounting.patch
readahead-state-based-method-routines.patch
readahead-state-based-method-routines-no-ra_flag_eof-on-single-page-file.patch
readahead-state-based-method.patch
readahead-state-based-method-readahead-state-based-method-stand-alone-size-limit-code.patch
readahead-context-based-method.patch
readahead-context-based-method-apply-stream_shift-size-limits-to-contexta-method.patch
readahead-context-based-method-fix-remain-counting.patch
readahead-context-based-method-slow-start.patch
readahead-initial-method-guiding-sizes.patch
readahead-initial-method-guiding-sizes-aggressive-initial-sizes.patch
readahead-initial-method-thrashing-guard-size.patch
readahead-initial-method-expected-read-size.patch
readahead-initial-method-user-recommended-size.patch
readahead-initial-method.patch
readahead-backward-prefetching-method.patch
readahead-backward-prefetching-method-add-use-case-comment.patch
readahead-seeking-reads-method.patch
readahead-thrashing-recovery-method.patch
readahead-call-scheme.patch
readahead-call-scheme-fix-fastcall.patch
readahead-call-scheme-no-fastcall-for-readahead_cache_hit.patch
readahead-laptop-mode.patch
readahead-loop-case.patch
readahead-nfsd-case.patch
readahead-turn-on-by-default.patch
readahead-debug-radix-tree-new-functions.patch
readahead-debug-traces-showing-accessed-file-names.patch
readahead-debug-traces-showing-read-patterns.patch
readahead-remove-size-limit-on-read_ahead_kb.patch
readahead-backward-prefetching-method-fix.patch
readahead-kconfig-option-readahead_allow_overheads.patch
readahead-kconfig-option-readahead_smooth_aging.patch
readahead-kconfig-option-readahead_hit_feedback.patch
readahead-remove-the-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

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux