From: Christoph Lameter <clameter@sgi.com>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
dkegel@google.com, Peter Zijlstra <a.p.zijlstra@chello.nl>,
David Miller <davem@davemloft.net>, Nick Piggin <npiggin@suse.de>
Subject: [RFC 2/7] Move checks from pageout() to shrink_page_list
Date: Mon, 20 Aug 2007 14:50:42 -0700 [thread overview]
Message-ID: <20070820215316.287244006@sgi.com> (raw)
In-Reply-To: <20070820215040.937296148@sgi.com>
[-- Attachment #1: move_checks_to_shrink_page_list --]
[-- Type: text/plain, Size: 4876 bytes --]
This is necessary because we soon will do other things than calling
pageout() from shrink_page_list().
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/vmscan.c | 90 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 45 insertions(+), 45 deletions(-)
Index: linux-2.6/mm/vmscan.c
===================================================================
--- linux-2.6.orig/mm/vmscan.c 2007-08-19 21:39:55.000000000 -0700
+++ linux-2.6/mm/vmscan.c 2007-08-19 21:47:56.000000000 -0700
@@ -273,8 +273,6 @@ static void handle_write_error(struct ad
/* possible outcome of pageout() */
typedef enum {
- /* failed to write page out, page is locked */
- PAGE_KEEP,
/* move page to the active list, page is locked */
PAGE_ACTIVATE,
/* page has been sent to the disk successfully, page is unlocked */
@@ -289,44 +287,6 @@ typedef enum {
*/
static pageout_t pageout(struct page *page, struct address_space *mapping)
{
- /*
- * If the page is dirty, only perform writeback if that write
- * will be non-blocking. To prevent this allocation from being
- * stalled by pagecache activity. But note that there may be
- * stalls if we need to run get_block(). We could test
- * PagePrivate for that.
- *
- * If this process is currently in generic_file_write() against
- * this page's queue, we can perform writeback even if that
- * will block.
- *
- * If the page is swapcache, write it back even if that would
- * block, for some throttling. This happens by accident, because
- * swap_backing_dev_info is bust: it doesn't reflect the
- * congestion state of the swapdevs. Easy to fix, if needed.
- * See swapfile.c:page_queue_congested().
- */
- if (!is_page_cache_freeable(page))
- return PAGE_KEEP;
- if (!mapping) {
- /*
- * Some data journaling orphaned pages can have
- * page->mapping == NULL while being dirty with clean buffers.
- */
- if (PagePrivate(page)) {
- if (try_to_free_buffers(page)) {
- ClearPageDirty(page);
- printk("%s: orphaned page\n", __FUNCTION__);
- return PAGE_CLEAN;
- }
- }
- return PAGE_KEEP;
- }
- if (mapping->a_ops->writepage == NULL)
- return PAGE_ACTIVATE;
- if (!may_write_to_queue(mapping->backing_dev_info))
- return PAGE_KEEP;
-
if (clear_page_dirty_for_io(page)) {
int res;
struct writeback_control wbc = {
@@ -504,18 +464,58 @@ static unsigned long shrink_page_list(st
if (!sc->may_writepage)
goto keep_locked;
+ /*
+ * If the page is dirty, only perform writeback if
+ * that write will be non-blocking. To prevent this
+ * allocation from being stalled by pagecache
+ * activity. But note that there may be stalls if
+ * we need to run get_block(). We could test
+ * PagePrivate for that.
+ *
+ * If this process is currently in
+ * generic_file_write() against this page's queue,
+ * we can perform writeback even if that will block.
+ *
+ * If the page is swapcache, write it back even if
+ * that would block, for some throttling. This happens
+ * by accident, because swap_backing_dev_info is bust:
+ * it doesn't reflect the congestion state of the
+ * swapdevs. Easy to fix, if needed.
+ * See swapfile.c:page_queue_congested().
+ */
+ if (!is_page_cache_freeable(page))
+ goto keep_locked;
+ if (!mapping) {
+ /*
+ * Some data journaling orphaned pages can
+ * have page->mapping == NULL while being
+ * dirty with clean buffers.
+ */
+ if (PagePrivate(page)) {
+ if (try_to_free_buffers(page)) {
+ ClearPageDirty(page);
+ printk("%s: orphaned page\n",
+ __FUNCTION__);
+ goto release_page;
+ }
+ }
+ goto keep_locked;
+ }
+ if (mapping->a_ops->writepage == NULL)
+ goto activate_locked;
+ if (!may_write_to_queue(mapping->backing_dev_info))
+ goto keep_locked;
+
/* Page is dirty, try to write it out here */
switch(pageout(page, mapping)) {
- case PAGE_KEEP:
- goto keep_locked;
case PAGE_ACTIVATE:
goto activate_locked;
case PAGE_SUCCESS:
if (PageWriteback(page) || PageDirty(page))
goto keep;
/*
- * A synchronous write - probably a ramdisk. Go
- * ahead and try to reclaim the page.
+ * A synchronous write - probably a ramdisk.
+ * Go ahead and try to reclaim the page.
*/
if (TestSetPageLocked(page))
goto keep;
@@ -526,7 +526,7 @@ static unsigned long shrink_page_list(st
; /* try to free the page below */
}
}
-
+release_page:
/*
* If the page has buffers, try to free the buffer mappings
* associated with this page. If we succeed we try to free
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2007-08-20 21:50 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-20 21:50 [RFC 0/7] Postphone reclaim laundry to write at high water marks Christoph Lameter
2007-08-20 21:50 ` [RFC 1/7] release_lru_pages(): Generic release of pages to the LRU Christoph Lameter
2007-08-21 14:52 ` Mel Gorman
2007-08-21 20:51 ` Christoph Lameter
2007-08-20 21:50 ` Christoph Lameter [this message]
2007-08-20 21:50 ` [RFC 3/7] shrink_page_list: Support isolating dirty pages on laundry list Christoph Lameter
2007-08-21 15:04 ` Mel Gorman
2007-08-21 20:53 ` Christoph Lameter
2007-08-20 21:50 ` [RFC 4/7] Pass laundry through shrink_inactive_list() and shrink_zone() Christoph Lameter
2007-08-20 21:50 ` [RFC 5/7] Laundry handling for direct reclaim Christoph Lameter
2007-08-21 15:06 ` Mel Gorman
2007-08-21 20:55 ` Christoph Lameter
2007-08-21 15:19 ` Mel Gorman
2007-08-21 21:00 ` Christoph Lameter
2007-08-20 21:50 ` [RFC 6/7] kswapd: Do laundry after reclaim Christoph Lameter
2007-08-20 21:50 ` [RFC 7/7] Switch of PF_MEMALLOC during writeout Christoph Lameter
2007-08-20 23:08 ` Andi Kleen
2007-08-20 23:19 ` Christoph Lameter
2007-08-21 1:13 ` Andi Kleen
2007-08-21 10:36 ` [RFC 0/7] Postphone reclaim laundry to write at high water marks Peter Zijlstra
2007-08-21 20:48 ` Christoph Lameter
2007-08-21 21:13 ` Peter Zijlstra
2007-08-21 21:29 ` Christoph Lameter
2007-08-21 21:43 ` Rik van Riel
2007-08-21 22:32 ` Christoph Lameter
2007-08-23 12:05 ` Andrea Arcangeli
2007-08-23 20:23 ` Christoph Lameter
2007-08-21 22:09 ` Peter Zijlstra
2007-08-21 22:43 ` Christoph Lameter
2007-08-22 7:02 ` Peter Zijlstra
2007-08-22 19:04 ` Christoph Lameter
2007-08-22 20:03 ` Peter Zijlstra
2007-08-22 20:16 ` Christoph Lameter
2007-08-23 7:39 ` Peter Zijlstra
2007-08-26 4:52 ` Rik van Riel
2007-08-23 12:16 ` Andrea Arcangeli
2007-08-22 7:45 ` Ingo Molnar
2007-08-22 19:19 ` Christoph Lameter
2007-08-23 12:08 ` Andrea Arcangeli
2007-08-23 12:59 ` Peter Zijlstra
2007-08-21 15:16 ` Rik van Riel
2007-08-21 20:59 ` Christoph Lameter
2007-08-21 21:14 ` Rik van Riel
2007-08-21 21:30 ` Christoph Lameter
2007-08-21 15:51 ` Dave McCracken
2007-08-21 21:03 ` Christoph Lameter
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=20070820215316.287244006@sgi.com \
--to=clameter@sgi.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=dkegel@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@suse.de \
/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