2006-11-29 11:29:56

by Wu Fengguang

[permalink] [raw]
Subject: [patch 1/2] readahead sysctl parameters fix

- do no extra readahead when (readahead_ratio == 1)
- define readahead_hit_rate inside CONFIG_ADAPTIVE_READAHEAD ifdefs

Signed-off-by: Fengguang Wu <[email protected]>
---

--- linux-2.6.19-rc6-mm1.orig/include/linux/mm.h
+++ linux-2.6.19-rc6-mm1/include/linux/mm.h
@@ -1074,7 +1074,7 @@ extern int readahead_ratio;

static inline int prefer_adaptive_readahead(void)
{
- return readahead_ratio > 1;
+ return readahead_ratio != 1;
}

/* Do stack extension */
--- linux-2.6.19-rc6-mm1.orig/Documentation/sysctl/vm.txt
+++ linux-2.6.19-rc6-mm1/Documentation/sysctl/vm.txt
@@ -234,7 +234,7 @@ plenty of memory(>>2MB per reader), a bi
readahead_ratio also selects the readahead logic:
VALUE CODE PATH
-------------------------------------------
- 0 disable readahead totally
+ 0 read as is, no extra readahead
1 select the stock readahead logic
2-100 select the adaptive readahead logic

--- linux-2.6.19-rc6-mm1.orig/mm/readahead.c
+++ linux-2.6.19-rc6-mm1/mm/readahead.c
@@ -40,10 +40,10 @@
/* Set read-ahead size to ##% of the thrashing-threshold. */
int readahead_ratio = 50;
EXPORT_SYMBOL_GPL(readahead_ratio);
-#endif

/* Readahead as long as cache hit ratio keeps above 1/##. */
int readahead_hit_rate = 0;
+#endif /* CONFIG_ADAPTIVE_READAHEAD */

/*
* Detailed classification of read-ahead behaviors.

--