All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org
Cc: dkegel@google.com
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: David Miller <davem@davemloft.net>
Cc: Nick Piggin <npiggin@suse.de>
Subject: [RFC 3/7] shrink_page_list: Support isolating dirty pages on laundry list
Date: Mon, 20 Aug 2007 14:50:43 -0700	[thread overview]
Message-ID: <20070820215316.526397437@sgi.com> (raw)
In-Reply-To: 20070820215040.937296148@sgi.com

[-- Attachment #1: shrink_modes --]
[-- Type: text/plain, Size: 2103 bytes --]

If a laundry list is specified then do not write out pages but put
dirty pages on a laundry list for later processing.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
 mm/vmscan.c |   23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

Index: linux-2.6/mm/vmscan.c
===================================================================
--- linux-2.6.orig/mm/vmscan.c	2007-08-19 23:13:28.000000000 -0700
+++ linux-2.6/mm/vmscan.c	2007-08-19 23:27:00.000000000 -0700
@@ -380,16 +380,22 @@ cannot_free:
 }
 
 /*
- * shrink_page_list() returns the number of reclaimed pages
+ * shrink_page_list() returns the number of reclaimed pages.
+ *
+ * If laundry is specified then dirty pages are put onto the
+ * laundry list and no writes are triggered.
  */
 static unsigned long shrink_page_list(struct list_head *page_list,
-					struct scan_control *sc)
+		struct scan_control *sc, struct list_head *laundry)
 {
 	LIST_HEAD(ret_pages);
 	struct pagevec freed_pvec;
 	int pgactivate = 0;
 	unsigned long nr_reclaimed = 0;
 
+	if (list_empty(page_list))
+		return 0;
+
 	cond_resched();
 
 	pagevec_init(&freed_pvec, 1);
@@ -407,10 +413,11 @@ static unsigned long shrink_page_list(st
 		if (TestSetPageLocked(page))
 			goto keep;
 
-		VM_BUG_ON(PageActive(page));
-
 		sc->nr_scanned++;
 
+		if (PageActive(page))
+			goto keep_locked;
+
 		if (!sc->may_swap && page_mapped(page))
 			goto keep_locked;
 
@@ -506,6 +513,12 @@ static unsigned long shrink_page_list(st
 			if (!may_write_to_queue(mapping->backing_dev_info))
 				goto keep_locked;
 
+			if (laundry) {
+				list_add(&page->lru, laundry);
+				unlock_page(page);
+				continue;
+			}
+
 			/* Page is dirty, try to write it out here */
 			switch(pageout(page, mapping)) {
 			case PAGE_ACTIVATE:
@@ -817,7 +830,7 @@ static unsigned long shrink_inactive_lis
 		spin_unlock_irq(&zone->lru_lock);
 
 		nr_scanned += nr_scan;
-		nr_freed = shrink_page_list(&page_list, sc);
+		nr_freed = shrink_page_list(&page_list, sc, NULL);
 		nr_reclaimed += nr_freed;
 		local_irq_disable();
 		if (current_is_kswapd()) {

-- 

WARNING: multiple messages have this Message-ID (diff)
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 3/7] shrink_page_list: Support isolating dirty pages on laundry list
Date: Mon, 20 Aug 2007 14:50:43 -0700	[thread overview]
Message-ID: <20070820215316.526397437@sgi.com> (raw)
In-Reply-To: 20070820215040.937296148@sgi.com

[-- Attachment #1: shrink_modes --]
[-- Type: text/plain, Size: 2329 bytes --]

If a laundry list is specified then do not write out pages but put
dirty pages on a laundry list for later processing.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
 mm/vmscan.c |   23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

Index: linux-2.6/mm/vmscan.c
===================================================================
--- linux-2.6.orig/mm/vmscan.c	2007-08-19 23:13:28.000000000 -0700
+++ linux-2.6/mm/vmscan.c	2007-08-19 23:27:00.000000000 -0700
@@ -380,16 +380,22 @@ cannot_free:
 }
 
 /*
- * shrink_page_list() returns the number of reclaimed pages
+ * shrink_page_list() returns the number of reclaimed pages.
+ *
+ * If laundry is specified then dirty pages are put onto the
+ * laundry list and no writes are triggered.
  */
 static unsigned long shrink_page_list(struct list_head *page_list,
-					struct scan_control *sc)
+		struct scan_control *sc, struct list_head *laundry)
 {
 	LIST_HEAD(ret_pages);
 	struct pagevec freed_pvec;
 	int pgactivate = 0;
 	unsigned long nr_reclaimed = 0;
 
+	if (list_empty(page_list))
+		return 0;
+
 	cond_resched();
 
 	pagevec_init(&freed_pvec, 1);
@@ -407,10 +413,11 @@ static unsigned long shrink_page_list(st
 		if (TestSetPageLocked(page))
 			goto keep;
 
-		VM_BUG_ON(PageActive(page));
-
 		sc->nr_scanned++;
 
+		if (PageActive(page))
+			goto keep_locked;
+
 		if (!sc->may_swap && page_mapped(page))
 			goto keep_locked;
 
@@ -506,6 +513,12 @@ static unsigned long shrink_page_list(st
 			if (!may_write_to_queue(mapping->backing_dev_info))
 				goto keep_locked;
 
+			if (laundry) {
+				list_add(&page->lru, laundry);
+				unlock_page(page);
+				continue;
+			}
+
 			/* Page is dirty, try to write it out here */
 			switch(pageout(page, mapping)) {
 			case PAGE_ACTIVATE:
@@ -817,7 +830,7 @@ static unsigned long shrink_inactive_lis
 		spin_unlock_irq(&zone->lru_lock);
 
 		nr_scanned += nr_scan;
-		nr_freed = shrink_page_list(&page_list, sc);
+		nr_freed = shrink_page_list(&page_list, sc, NULL);
 		nr_reclaimed += nr_freed;
 		local_irq_disable();
 		if (current_is_kswapd()) {

-- 

--
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>

  parent reply	other threads:[~2007-08-20 21:53 UTC|newest]

Thread overview: 91+ 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 ` Christoph Lameter
2007-08-20 21:50 ` [RFC 1/7] release_lru_pages(): Generic release of pages to the LRU Christoph Lameter
2007-08-20 21:50   ` Christoph Lameter
2007-08-21 14:52   ` Mel Gorman
2007-08-21 14:52     ` Mel Gorman
2007-08-21 20:51     ` Christoph Lameter
2007-08-21 20:51       ` Christoph Lameter
2007-08-20 21:50 ` [RFC 2/7] Move checks from pageout() to shrink_page_list Christoph Lameter
2007-08-20 21:50   ` 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 15:04     ` Mel Gorman
2007-08-21 20:53     ` Christoph Lameter
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   ` Christoph Lameter
2007-08-20 21:50 ` [RFC 5/7] Laundry handling for direct reclaim Christoph Lameter
2007-08-20 21:50   ` Christoph Lameter
2007-08-21 15:06   ` Mel Gorman
2007-08-21 15:06     ` Mel Gorman
2007-08-21 20:55     ` Christoph Lameter
2007-08-21 20:55       ` Christoph Lameter
2007-08-21 15:19   ` Mel Gorman
2007-08-21 15:19     ` Mel Gorman
2007-08-21 21:00     ` Christoph Lameter
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   ` Christoph Lameter
2007-08-20 21:50 ` [RFC 7/7] Switch of PF_MEMALLOC during writeout Christoph Lameter
2007-08-20 21:50   ` Christoph Lameter
2007-08-20 23:08   ` Andi Kleen
2007-08-20 23:08     ` Andi Kleen
2007-08-20 23:19     ` Christoph Lameter
2007-08-20 23:19       ` Christoph Lameter
2007-08-21  1:13       ` Andi Kleen
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 10:36   ` Peter Zijlstra
2007-08-21 20:48   ` Christoph Lameter
2007-08-21 20:48     ` Christoph Lameter
2007-08-21 21:13     ` Peter Zijlstra
2007-08-21 21:13       ` Peter Zijlstra
2007-08-21 21:29       ` Christoph Lameter
2007-08-21 21:29         ` Christoph Lameter
2007-08-21 21:43         ` Rik van Riel
2007-08-21 21:43           ` Rik van Riel
2007-08-21 22:32           ` Christoph Lameter
2007-08-21 22:32             ` Christoph Lameter
2007-08-23 12:05             ` Andrea Arcangeli
2007-08-23 12:05               ` Andrea Arcangeli
2007-08-23 20:23               ` Christoph Lameter
2007-08-23 20:23                 ` Christoph Lameter
2007-08-21 22:09         ` Peter Zijlstra
2007-08-21 22:09           ` Peter Zijlstra
2007-08-21 22:43           ` Christoph Lameter
2007-08-21 22:43             ` Christoph Lameter
2007-08-22  7:02             ` Peter Zijlstra
2007-08-22  7:02               ` Peter Zijlstra
2007-08-22 19:04               ` Christoph Lameter
2007-08-22 19:04                 ` Christoph Lameter
2007-08-22 20:03                 ` Peter Zijlstra
2007-08-22 20:03                   ` Peter Zijlstra
2007-08-22 20:16                   ` Christoph Lameter
2007-08-22 20:16                     ` Christoph Lameter
2007-08-23  7:39                     ` Peter Zijlstra
2007-08-23  7:39                       ` Peter Zijlstra
2007-08-26  4:52                     ` Rik van Riel
2007-08-26  4:52                       ` Rik van Riel
2007-08-23 12:16                   ` Andrea Arcangeli
2007-08-23 12:16                     ` Andrea Arcangeli
2007-08-22  7:45             ` Ingo Molnar
2007-08-22  7:45               ` Ingo Molnar
2007-08-22 19:19               ` Christoph Lameter
2007-08-22 19:19                 ` Christoph Lameter
2007-08-23 12:08           ` Andrea Arcangeli
2007-08-23 12:08             ` Andrea Arcangeli
2007-08-23 12:59             ` Peter Zijlstra
2007-08-23 12:59               ` Peter Zijlstra
2007-08-21 15:16 ` Rik van Riel
2007-08-21 15:16   ` Rik van Riel
2007-08-21 20:59   ` Christoph Lameter
2007-08-21 20:59     ` Christoph Lameter
2007-08-21 21:14     ` Rik van Riel
2007-08-21 21:14       ` Rik van Riel
2007-08-21 21:30       ` Christoph Lameter
2007-08-21 21:30         ` Christoph Lameter
2007-08-21 15:51 ` Dave McCracken
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.526397437@sgi.com \
    --to=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.