Thread (28 messages) 28 messages, 2 authors, 2012-10-17

Re: Re: [PATCH 2/5] mm/readahead: Change the condition for SetPageReadahead

From: Raghavendra D Prabhu <hidden>
Date: 2012-09-26 01:29:06

Hi,


* On Sat, Sep 22, 2012 at 08:49:20PM +0800, Fengguang Wu [off-list ref] wrote:
On Sat, Sep 22, 2012 at 04:03:11PM +0530, raghu.prabhu13@gmail.com wrote:
quoted
From: Raghavendra D Prabhu <redacted>

If page lookup from radix_tree_lookup is successful and its index page_idx ==
nr_to_read - lookahead_size, then SetPageReadahead never gets called, so this
fixes that.
NAK. Sorry. It's actually an intentional behavior, so that for the
common cases of many cached files that are accessed frequently, no
PG_readahead will be set at all to pointlessly trap into the readahead
routines once and again.
ACK, thanks for explaining that. However, regarding this, I would 
like to know if the implications of the patch 
51daa88ebd8e0d437289f589af29d4b39379ea76 will still apply if 
PG_readahead is not set.
Perhaps we need a patch for commenting that case. :)

Thanks,
Fengguang
quoted
Signed-off-by: Raghavendra D Prabhu <redacted>
---
 mm/readahead.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/readahead.c b/mm/readahead.c
index 461fcc0..fec726c 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -189,8 +189,10 @@ __do_page_cache_readahead(struct address_space *mapping, struct file *filp,
 			break;
 		page->index = page_offset;
 		list_add(&page->lru, &page_pool);
-		if (page_idx == nr_to_read - lookahead_size)
+		if (page_idx >= nr_to_read - lookahead_size) {
 			SetPageReadahead(page);
+			lookahead_size = 0;
+		}
 		ret++;
 	}

--
1.7.12.1



Regards,
-- 
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help