[lkml]   [2007]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 1/9] readahead: simplify readahead call scheme
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)

He must try async readahead, too:

page = find_get_page(...);
if (PageReadahead(page))

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)
else if (PageReadahead(page))

Signed-off-by: Fengguang Wu <>
mm/readahead.c | 8 ++++++++
1 file changed, 8 insertions(+)

--- linux-2.6.24-rc4-mm1.orig/mm/readahead.c
+++ linux-2.6.24-rc4-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;

+ /*
+ * 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);


 \ /
  Last update: 2007-12-16 13:11    [W:0.069 / U:16.736 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site