* [patch 0/4] Adaptive readahead patchset V14 updates
@ 2006-05-30 8:40 ` Wu Fengguang
0 siblings, 0 replies; 4+ messages in thread
From: Wu Fengguang @ 2006-05-30 8:40 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Wu Fengguang
Andrew,
These are some fixes/updates for the adaptive readahead V14.
- apply stream_shift size limits to contexta method
- *remain in query_page_cache_segment() is over counted by 1, fix it
- add use case comment for backward prefetching
Please apply, thanks.
Wu
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch 1/4] readahead: state based method - stand-alone size limit code
@ 2006-05-30 8:40 ` Wu Fengguang
0 siblings, 0 replies; 4+ messages in thread
From: Wu Fengguang @ 2006-05-30 8:40 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Wu Fengguang
[-- Attachment #1: readahead-method-stateful-fix-size-limit-sep.patch --]
[-- Type: text/plain, Size: 2594 bytes --]
Separate out the readahead/lookahead sizes limiting code,
and put them to stand-alone limit_rala() function.
Signed-off-by: Wu Fengguang <wfg@mail.ustc.edu.cn>
---
--- linux-2.6.17-rc4-mm3.orig/mm/readahead.c
+++ linux-2.6.17-rc4-mm3/mm/readahead.c
@@ -1009,10 +1009,8 @@ static int ra_dispatch(struct file_ra_st
* - @la_size stores the look-ahead size of previous request.
*/
static int adjust_rala(unsigned long ra_max,
- unsigned long *ra_size, unsigned long *la_size)
+ unsigned long *ra_size, unsigned long *la_size)
{
- unsigned long stream_shift = *la_size;
-
/*
* Substract the old look-ahead to get real safe size for the next
* read-ahead request.
@@ -1029,8 +1027,16 @@ static int adjust_rala(unsigned long ra_
*/
*la_size = *ra_size / LOOKAHEAD_RATIO;
+ return 1;
+}
+
+static void limit_rala(unsigned long ra_max, unsigned long la_old,
+ unsigned long *ra_size, unsigned long *la_size)
+{
+ unsigned long stream_shift;
+
/*
- * Apply upper limits.
+ * Apply basic upper limits.
*/
if (*ra_size > ra_max)
*ra_size = ra_max;
@@ -1041,11 +1047,9 @@ static int adjust_rala(unsigned long ra_
* Make sure stream_shift is not too small.
* (So that the next global_shift will not be too small.)
*/
- stream_shift += (*ra_size - *la_size);
+ stream_shift = la_old + (*ra_size - *la_size);
if (stream_shift < *ra_size / 4)
*la_size -= (*ra_size / 4 - stream_shift);
-
- return 1;
}
/*
@@ -1117,13 +1121,13 @@ state_based_readahead(struct address_spa
struct page *page, pgoff_t index,
unsigned long req_size, unsigned long ra_max)
{
- unsigned long ra_old;
- unsigned long ra_size;
- unsigned long la_size;
+ unsigned long ra_old, ra_size;
+ unsigned long la_old, la_size;
unsigned long remain_space;
unsigned long growth_limit;
- la_size = ra->readahead_index - index;
+ la_old = la_size = ra->readahead_index - index;
+ ra_old = ra_readahead_size(ra);
ra_size = compute_thrashing_threshold(ra, &remain_space);
if (page && remain_space <= la_size && la_size > 1) {
@@ -1131,7 +1135,6 @@ state_based_readahead(struct address_spa
return 0;
}
- ra_old = ra_readahead_size(ra);
growth_limit = req_size;
growth_limit += ra_max / 16;
growth_limit += (2 + readahead_ratio / 64) * ra_old;
@@ -1141,6 +1144,8 @@ state_based_readahead(struct address_spa
if (!adjust_rala(growth_limit, &ra_size, &la_size))
return 0;
+ limit_rala(growth_limit, la_old, &ra_size, &la_size);
+
ra_set_class(ra, RA_CLASS_STATE);
ra_set_index(ra, index, ra->readahead_index);
ra_set_size(ra, ra_size, la_size);
--
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch 3/4] readahead: context based method - fix *remain counting
@ 2006-05-30 8:40 ` Wu Fengguang
0 siblings, 0 replies; 4+ messages in thread
From: Wu Fengguang @ 2006-05-30 8:40 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Wu Fengguang
[-- Attachment #1: readahead-method-context-fix-remain.patch --]
[-- Type: text/plain, Size: 514 bytes --]
*remain in query_page_cache_segment() is over counted by 1, fix it.
Signed-off-by: Wu Fengguang <wfg@mail.ustc.edu.cn>
---
--- linux-2.6.17-rc4-mm3.orig/mm/readahead.c
+++ linux-2.6.17-rc4-mm3/mm/readahead.c
@@ -1334,7 +1334,7 @@ static unsigned long query_page_cache_se
index = radix_tree_scan_hole_backward(&mapping->page_tree,
offset - 1, ra_max);
- *remain = offset - index;
+ *remain = (offset - 1) - index;
if (offset == ra->readahead_index && ra_cache_hit_ok(ra))
count = *remain;
--
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch 4/4] readahead: backward prefetching method - add use case comment
@ 2006-05-30 8:40 ` Wu Fengguang
0 siblings, 0 replies; 4+ messages in thread
From: Wu Fengguang @ 2006-05-30 8:40 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Wu Fengguang
[-- Attachment #1: readahead-method-backward-fix-use-case-comment.patch --]
[-- Type: text/plain, Size: 583 bytes --]
Backward prefetching is vital to structural analysis and some other
scientific applications. Comment this use case.
Signed-off-by: Wu Fengguang <wfg@mail.ustc.edu.cn>
---
--- linux-2.6.17-rc4-mm3.orig/mm/readahead.c
+++ linux-2.6.17-rc4-mm3/mm/readahead.c
@@ -1540,6 +1540,8 @@ initial_readahead(struct address_space *
* Backward prefetching.
*
* No look-ahead and thrashing safety guard: should be unnecessary.
+ *
+ * Important for certain scientific arenas(i.e. structural analysis).
*/
static int
try_read_backward(struct file_ra_state *ra, pgoff_t begin_index,
--
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-05-30 8:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-30 8:40 [patch 0/4] Adaptive readahead patchset V14 updates Wu Fengguang
2006-05-30 8:40 ` Wu Fengguang
2006-05-30 8:40 ` [patch 1/4] readahead: state based method - stand-alone size limit code Wu Fengguang
2006-05-30 8:40 ` Wu Fengguang
2006-05-30 8:40 ` [patch 3/4] readahead: context based method - fix *remain counting Wu Fengguang
2006-05-30 8:40 ` Wu Fengguang
2006-05-30 8:40 ` [patch 4/4] readahead: backward prefetching method - add use case comment Wu Fengguang
2006-05-30 8:40 ` Wu Fengguang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.