[updated PATCH 1/6] readahead: context based method - slow start

From: Wu Fengguang
Date: Sun Jun 25 2006 - 22:33:52 EST


The context method will lead to noticable overhead(readahead miss)
on very sparse random reads.

Having the readahead window to start slowly makes it much better.
But still startup quick if the user prefers sparse readahead.

Benchmarks of reading randomly 100,000 pages on a 1000,000 pages _sparse_ file:

ARA before patch ARA STOCK
================ ================ ================
real 2.779s 2.782s 2.552s 2.606s 2.477s 2.521s
user 1.120s 1.184s 1.133s 1.155s 1.097s 1.159s
sys 1.248s 1.208s 1.093s 1.086s 1.079s 1.064s

Signed-off-by: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx>
---

--- linux-2.6.17-mm2.orig/mm/readahead.c
+++ linux-2.6.17-mm2/mm/readahead.c
@@ -1548,6 +1548,12 @@ try_context_based_readahead(struct addre
return -1;
} else if (prev_page || probe_page(mapping, index - 1)) {
ra_index = index;
+ /*
+ * Slow start of readahead window.
+ * It helps avoid most readahead miss on sparse random reads.
+ */
+ if (readahead_hit_rate == 1)
+ ra_min = 1;
} else if (readahead_hit_rate > 1) {
ra_index = find_segtail_backward(mapping, index,
readahead_hit_rate + ra_min);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/