lkml.org 
[lkml]   [2007]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 3/8] readahead: state based method: prevent tiny size
- cancel look-ahead if readahead size is small compared to the look-ahead size,
to avoid too small I/O size, and not to add more memory/io pressure on the
possibly loaded system.
- prevent issuing tiny readahead size, by applying a minimal limit

Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
---
mm/readahead.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)

--- linux-2.6.20-rc4-mm1.orig/mm/readahead.c
+++ linux-2.6.20-rc4-mm1/mm/readahead.c
@@ -932,17 +932,21 @@ static int adjust_rala(unsigned long ra_
unsigned long *ra_size, unsigned long *la_size)
{
/*
- * Substract the old look-ahead to get real safe size for the next
- * read-ahead request.
+ * Cancel asynchrous read-ahead,
+ * if there is a major upsurge of load, or fall of this stream's speed.
*/
- if (*ra_size > *la_size)
- *ra_size -= *la_size;
- else {
+ if (*ra_size <= *la_size * 2) {
ra_account(NULL, RA_EVENT_READAHEAD_SHRINK, *ra_size);
return 0;
}

/*
+ * Substract the old look-ahead to get real safe size for the next
+ * read-ahead request.
+ */
+ *ra_size -= *la_size;
+
+ /*
* Set new la_size according to the (still large) ra_size.
*/
*la_size = *ra_size / LOOKAHEAD_RATIO;
@@ -956,6 +960,13 @@ static void limit_rala(unsigned long ra_
unsigned long stream_shift;

/*
+ * Protect against too small I/O sizes,
+ * by mapping [0, 4*min] to [min, 4*min].
+ */
+ if (*ra_size < 4 * MIN_RA_PAGES)
+ *ra_size = MIN_RA_PAGES + *ra_size * 3 / 4;
+
+ /*
* Apply basic upper limits.
*/
if (*ra_size > ra_max)
--
-
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: 2007-01-27 09:31    [W:0.095 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site