From: Fengguang Wu <wfg@mail.ustc.edu.cn>
To: Andrew Morton <akpm@osdl.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nick Piggin <npiggin@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/9] readahead: simplify readahead call scheme
Date: Sat, 22 Dec 2007 09:31:48 +0800 [thread overview]
Message-ID: <398287205.56298@ustc.edu.cn> (raw)
Message-ID: <20071222013314.546311527@mail.ustc.edu.cn> (raw)
In-Reply-To: 20071222013147.897522982@mail.ustc.edu.cn
[-- Attachment #1: readahead-merge-sync-async.patch --]
[-- Type: text/plain, Size: 1668 bytes --]
It is insane and error-prone to insist on the call sites to check for async
readahead after doing any sync one. I.e. whenever someone do a sync readahead:
if (!page)
page_cache_sync_readahead(...);
He must try async readahead, too:
page = find_get_page(...);
if (PageReadahead(page))
page_cache_async_readahead(...);
The tricky point is that PG_readahead could be set by a sync readahead for the
_current_ newly faulted in page, and the readahead code simply expects one more
callback to handle it. If the caller fails to do so, it will miss the
PG_readahead bits and never able to start an async readahead.
Avoid it by piggy-backing the async part _inside_ the readahead code.
Now if an async readahead should be started immediately after a sync one,
the readahead logic itself will do it. So the following code becomes valid:
if (!page)
page_cache_sync_readahead(...);
else if (PageReadahead(page))
page_cache_async_readahead(...);
Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
---
mm/readahead.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- linux-2.6.24-rc5-mm1.orig/mm/readahead.c
+++ linux-2.6.24-rc5-mm1/mm/readahead.c
@@ -402,6 +402,14 @@ ondemand_readahead(struct address_space
ra->async_size = ra->size > req_size ? ra->size - req_size : ra->size;
readit:
+ /*
+ * An async readahead should be triggered immediately.
+ * Instead of demanding all call sites to check for async readahead
+ * immediate after a sync one, start the async part now and here.
+ */
+ if (!hit_readahead_marker && ra->size == ra->async_size)
+ ra->size *= 2;
+
return ra_submit(ra, mapping, filp);
}
--
next prev parent reply other threads:[~2007-12-22 1:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071222013147.897522982@mail.ustc.edu.cn>
2007-12-22 1:31 ` [PATCH 0/9] mmap read-around and readahead take 2 Fengguang Wu
[not found] ` <20071222013314.546311527@mail.ustc.edu.cn>
2007-12-22 1:31 ` Fengguang Wu [this message]
[not found] ` <20071222013314.688868252@mail.ustc.edu.cn>
2007-12-22 1:31 ` [PATCH 2/9] readahead: clean up and simplify the code for filemap page fault readahead Fengguang Wu
[not found] ` <20071222013314.837299924@mail.ustc.edu.cn>
2007-12-22 1:31 ` [PATCH 3/9] readahead: auto detection of sequential mmap reads Fengguang Wu
[not found] ` <20071222013314.978523200@mail.ustc.edu.cn>
2007-12-22 1:31 ` [PATCH 4/9] readahead: quick startup on sequential mmap readahead Fengguang Wu
[not found] ` <20071222013315.126541416@mail.ustc.edu.cn>
2007-12-22 1:31 ` [PATCH 5/9] readahead: make ra_submit() non-static Fengguang Wu
[not found] ` <20071222013315.268922128@mail.ustc.edu.cn>
2007-12-22 1:31 ` [PATCH 6/9] readahead: save mmap read-around states in file_ra_state Fengguang Wu
[not found] ` <20071222013315.408285407@mail.ustc.edu.cn>
2007-12-22 1:31 ` [PATCH 7/9] readahead: remove unused do_page_cache_readahead() Fengguang Wu
[not found] ` <20071222013315.557435210@mail.ustc.edu.cn>
2007-12-22 1:31 ` [PATCH 8/9] readahead: move max_sane_readahead() calls into force_page_cache_readahead() Fengguang Wu
[not found] ` <20071222013315.699008042@mail.ustc.edu.cn>
2007-12-22 1:31 ` [PATCH 9/9] readahead: call max_sane_readahead() in ondemand_readahead() Fengguang Wu
[not found] <20071216115927.986126305@mail.ustc.edu.cn>
[not found] ` <20071216120417.586021813@mail.ustc.edu.cn>
2007-12-16 11:59 ` [PATCH 1/9] readahead: simplify readahead call scheme Fengguang Wu
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=398287205.56298@ustc.edu.cn \
--to=wfg@mail.ustc.edu.cn \
--cc=akpm@osdl.org \
--cc=torvalds@linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox