2007-01-27 08:25:41

by Wu Fengguang

[permalink] [raw]
Subject: [PATCH 4/8] readahead: state based method: move readahead_ratio out of compute_thrashing_threshold()

Make compute_thrashing_threshold() a pure computing routine,
by moving the readahead_ratio policy out of it.

Signed-off-by: Fengguang Wu <[email protected]>
---
mm/readahead.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- linux-2.6.20-rc4-mm1.orig/mm/readahead.c
+++ linux-2.6.20-rc4-mm1/mm/readahead.c
@@ -1025,7 +1025,7 @@ static unsigned long compute_thrashing_t
stream_shift = ra_invoke_interval(ra);

/* future safe space */
- ll = (uint64_t) stream_shift * (global_size >> 9) * readahead_ratio * 5;
+ ll = (uint64_t) stream_shift * global_size;
do_div(ll, global_shift);
ra_size = ll;

@@ -1063,6 +1063,7 @@ state_based_readahead(struct address_spa
la_old = la_size = ra->readahead_index - offset;
ra_old = ra_readahead_size(ra);
ra_size = compute_thrashing_threshold(ra, &remain_space);
+ ra_size = ra_size * readahead_ratio / 100;

if (page && remain_space <= la_size) {
rescue_pages(page, la_size);

--