From: Fengguang Wu <wfg@mail.ustc.edu.cn>
To: Andrew Morton <akpm@osdl.org>
Cc: Martin Peschke <mp3@de.ibm.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 6/8] readahead: thrashing recovery method fix
Date: Sat, 27 Jan 2007 16:02:25 +0800 [thread overview]
Message-ID: <369886264.06097@ustc.edu.cn> (raw)
Message-ID: <20070127082530.010446696@mail.ustc.edu.cn> (raw)
In-Reply-To: 20070127080219.161473179@mail.ustc.edu.cn
[-- Attachment #1: readahead-thrashing-recovery-method-fix.patch --]
[-- Type: text/plain, Size: 1951 bytes --]
- keep lookahead_index if the current chunk is lost, so that when we
revisted this stream, the state based method see a consistent state.
- correct the thrashing-threshold computation
- discount read-ahead size more, to free more memory to the system on pressure
- disable look-ahead when thrashed, just to be safe
Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
---
mm/readahead.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
--- linux-2.6.20-rc4-mm1.orig/mm/readahead.c
+++ linux-2.6.20-rc4-mm1/mm/readahead.c
@@ -1524,28 +1524,26 @@ thrashing_recovery_readahead(struct addr
ra->readahead_index - offset);
#endif
- /*
- * Some thrashing occur in (ra_index, la_index], in which case the
- * old read-ahead chunk is lost soon after the new one is allocated.
- * Ensure that we recover all needed pages in the old chunk.
- */
- if (offset < ra->ra_index)
- ra_size = ra->ra_index - offset;
- else {
+ if (offset < ra->ra_index) {
+ /*
+ * Thrashed when we are in [la_index, ra_index), i.e.
+ * the old chunk is lost soon after the new one is allocated.
+ * Ensure that we recover all needed pages in the old chunk.
+ * And futher keep the lookahead_index untouched.
+ */
+ ra_size = ra->lookahead_index - offset;
+ } else {
/* After thrashing, we know the exact thrashing-threshold. */
- ra_size = offset - ra->ra_index;
+ ra_size = offset - ra->la_index;
update_ra_thrash_bytes(mapping->backing_dev_info, ra_size);
- /* And we'd better be a bit conservative. */
- ra_size = ra_size * 3 / 4;
+ /* And be cooperative: the system may be hunting for memory. */
+ ra_size = MIN_RA_PAGES + ra_size / 2;
}
- if (ra_size > ra_max)
- ra_size = ra_max;
-
ra_set_class(ra, RA_CLASS_THRASHING);
ra_set_index(ra, offset, offset);
- ra_set_size(ra, ra_size, ra_size / LOOKAHEAD_RATIO);
+ ra_set_size(ra, ra_size, 0);
return ra_submit(ra, mapping, filp);
}
--
next prev parent reply other threads:[~2007-01-27 8:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-27 8:02 [PATCH 0/8] readahead updates Fengguang Wu
2007-01-27 8:02 ` Fengguang Wu
2007-01-27 8:02 ` [PATCH 1/8] readahead: min/max sizes: increase VM_MIN_READAHEAD to 32KB Fengguang Wu
2007-01-27 8:02 ` Fengguang Wu
2007-01-27 8:02 ` [PATCH 2/8] readahead: state based method routines: explicitly embed class_new/class_old inside flags Fengguang Wu
2007-01-27 8:02 ` Fengguang Wu
2007-01-27 8:02 ` [PATCH 3/8] readahead: state based method: prevent tiny size Fengguang Wu
2007-01-27 8:02 ` Fengguang Wu
2007-01-27 8:02 ` [PATCH 4/8] readahead: state based method: move readahead_ratio out of compute_thrashing_threshold() Fengguang Wu
2007-01-27 8:02 ` Fengguang Wu
2007-01-27 8:02 ` [PATCH 5/8] readahead: initial method: user recommended size: rename to read_ahead_initial_kb Fengguang Wu
2007-01-27 8:02 ` Fengguang Wu
2007-01-27 8:02 ` Fengguang Wu [this message]
2007-01-27 8:02 ` [PATCH 6/8] readahead: thrashing recovery method fix Fengguang Wu
2007-01-27 8:02 ` [PATCH 7/8] readahead: call scheme: fix thrashed unaligned read Fengguang Wu
2007-01-27 8:02 ` Fengguang Wu
2007-01-27 8:02 ` [PATCH 8/8] readahead: laptop mode fix Fengguang Wu
2007-01-27 8:02 ` Fengguang Wu
2007-01-31 13:37 ` [PATCH 0/8] readahead updates martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=369886264.06097@ustc.edu.cn \
--to=wfg@mail.ustc.edu.cn \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mp3@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.