LKML Archive on
help / color / mirror / Atom feed
From: Andy Whitcroft <>
To: Andrew Morton <>
	Andy Whitcroft <>, Mel Gorman <>
Subject: [PATCH 2/5] lumpy: isolate_lru_pages wants to specifically take active or inactive pages
Date: Tue, 27 Feb 2007 11:34:52 -0800	[thread overview]
Message-ID: <f2cdac47f652dc10d19f6041997e85b1@kernel> (raw)
In-Reply-To: exportbomb.1172604830@kernel

The caller of isolate_lru_pages specifically knows whether it wants
to take either inactive or active pages.  Currently we take the
state of the LRU page at hand and use that to scan for matching
pages in the order sized block.  If that page is transiting we
can scan for the wrong type.  The caller knows what they want and
should be telling us.  Pass in the required active/inactive state
and match against that.

Note, that now we pass the expected active state when scanning the
active/inactive lists we may find missmatching target pages, pages
which are in the process of changing state.  This is no longer an
error and we should simply ignore them.

Signed-off-by: Andy Whitcroft <>
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f15ffcb..b878d54 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -663,12 +663,13 @@ static int __isolate_lru_page(struct page *page, int active)
  * @dst:	The temp list to put pages on to.
  * @scanned:	The number of pages that were scanned.
  * @order:	The caller's attempted allocation order
+ * @active:	The caller's trying to obtain active or inactive pages
  * returns how many pages were moved onto *@dst.
 static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
 		struct list_head *src, struct list_head *dst,
-		unsigned long *scanned, int order)
+		unsigned long *scanned, int order, int active)
 	unsigned long nr_taken = 0;
 	unsigned long scan;
@@ -678,7 +679,6 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
 		unsigned long pfn;
 		unsigned long end_pfn;
 		unsigned long page_pfn;
-		int active;
 		int zone_id;
 		page = lru_to_page(src);
@@ -686,20 +686,16 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
-		active = PageActive(page);
 		switch (__isolate_lru_page(page, active)) {
 		case 0:
 			list_move(&page->lru, dst);
-		case -EBUSY:
-			/* else it is being freed elsewhere */
+		default:
+			/* page is being freed, or is a missmatch */
 			list_move(&page->lru, src);
-		default:
-			BUG();
 		if (!order)
@@ -768,8 +764,8 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
 		unsigned long nr_freed;
 		nr_taken = isolate_lru_pages(sc->swap_cluster_max,
-					     &zone->inactive_list,
-					     &page_list, &nr_scan, sc->order);
+				     &zone->inactive_list,
+				     &page_list, &nr_scan, sc->order, 0);
 		__mod_zone_page_state(zone, NR_INACTIVE, -nr_taken);
 		zone->pages_scanned += nr_scan;
 		zone->total_scanned += nr_scan;
@@ -916,7 +912,7 @@ force_reclaim_mapped:
 	pgmoved = isolate_lru_pages(nr_pages, &zone->active_list,
-				    &l_hold, &pgscanned, sc->order);
+				    &l_hold, &pgscanned, sc->order, 1);
 	zone->pages_scanned += pgscanned;
 	__mod_zone_page_state(zone, NR_ACTIVE, -pgmoved);

  parent reply	other threads:[~2007-02-27 19:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-27 19:33 [PATCH 0/5] Lumpy Reclaim V4 Andy Whitcroft
2007-02-27 19:34 ` [PATCH 1/5] Lumpy Reclaim V3 Andy Whitcroft
2007-02-28 18:14   ` Christoph Lameter
2007-03-02 15:45     ` Andy Whitcroft
2007-02-27 19:34 ` Andy Whitcroft [this message]
2007-02-28 18:17   ` [PATCH 2/5] lumpy: isolate_lru_pages wants to specifically take active or inactive pages Christoph Lameter
2007-03-02 15:57     ` Andy Whitcroft
2007-02-27 19:35 ` [PATCH 3/5] lumpy: ensure that we compare PageActive and active safely Andy Whitcroft
2007-02-27 19:35 ` [PATCH 4/5] lumpy: update commentry on subtle comparisons and rounding assumptions Andy Whitcroft
2007-02-27 19:36 ` [PATCH 5/5] lumpy: only check for valid pages when holes are present Andy Whitcroft

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2cdac47f652dc10d19f6041997e85b1@kernel \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).