mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zach Brown <zach.brown@oracle.com>
To: Nick Piggin <nickpiggin@yahoo.com.au>,
	Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] AOP_TRUNCATED_PAGE victims in read_pages() belong in the LRU
Date: Wed,  3 May 2006 13:07:55 -0700 (PDT)	[thread overview]
Message-ID: <20060503200755.1608.87580.sendpatchset@tetsuo.zabbo.net> (raw)

AOP_TRUNCATED_PAGE victims in read_pages() belong in the LRU

Nick Piggin rightly pointed out that the introduction of AOP_TRUNCATED_PAGE to
read_pages() was wrong to leave A_T_P victim pages in the page cache but not
put them in the LRU.  Failing to do so hid them from the VM.

A_T_P just means that the aop method unlocked the page rather than performing
IO.  It would be very rare that the page was truncated between the unlock and
testing A_T_P.  So we leave the pages in the LRU for likely reuse soon rather
than backing them back out of the page cache.  We do this by matching the
behaviour before the A_T_P introduction which added pages to the LRU regardless
of what ->readpage() did.

This doesn't include the unrelated cleanup in Nick's initial fix which changed
read_pages() to return void to match its only caller's behaviour of ignoring
errors.

Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Zach Brown <zach.brown@oracle.com>
---

 mm/readahead.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Index: 2.6.17-rc3-git7-read_pages-fix/mm/readahead.c
===================================================================
--- 2.6.17-rc3-git7-read_pages-fix.orig/mm/readahead.c
+++ 2.6.17-rc3-git7-read_pages-fix/mm/readahead.c
@@ -182,14 +182,11 @@ static int read_pages(struct address_spa
 		list_del(&page->lru);
 		if (!add_to_page_cache(page, mapping,
 					page->index, GFP_KERNEL)) {
-			ret = mapping->a_ops->readpage(filp, page);
-			if (ret != AOP_TRUNCATED_PAGE) {
-				if (!pagevec_add(&lru_pvec, page))
-					__pagevec_lru_add(&lru_pvec);
-				continue;
-			} /* else fall through to release */
-		}
-		page_cache_release(page);
+			mapping->a_ops->readpage(filp, page);
+			if (!pagevec_add(&lru_pvec, page))
+				__pagevec_lru_add(&lru_pvec);
+		} else
+			page_cache_release(page);
 	}
 	pagevec_lru_add(&lru_pvec);
 	ret = 0;

                 reply	other threads:[~2006-05-03 20:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060503200755.1608.87580.sendpatchset@tetsuo.zabbo.net \
    --to=zach.brown@oracle.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=torvalds@osdl.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

Powered by JetHome