
Pages in a specified memory section are migrated when the section
is removed.

Signed-off-by: Hirokazu Takahashi <taka@valinux.co.jp>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---

 memhotplug-dave/mm/page_alloc.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+)

diff -puN mm/page_alloc.c~page_migration23-memsection_migrate mm/page_alloc.c
--- memhotplug/mm/page_alloc.c~page_migration23-memsection_migrate	2005-01-04 11:30:21.000000000 -0800
+++ memhotplug-dave/mm/page_alloc.c	2005-01-04 11:30:21.000000000 -0800
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/suspend.h>
 #include <linux/pagevec.h>
+#include <linux/mmigrate.h>
 #include <linux/blkdev.h>
 #include <linux/slab.h>
 #include <linux/notifier.h>
@@ -684,6 +685,30 @@ perthread_pages_alloc(void)
 		return NULL;
 }
 
+static int
+grab_capturing_pages(struct list_head *page_list, unsigned long start_pfn,
+							unsigned long nr_pages)
+{
+	struct page *page;
+	struct zone *zone;
+	int rest = 0;
+	int i;
+
+	for (i = 0; i < nr_pages; i++) {
+		page = pfn_to_page(start_pfn + i);
+		zone = page_zone(page);
+		spin_lock_irq(&zone->lru_lock);
+		if (page_under_capture(page)) {
+			if (PageLRU(page) && __steal_page_from_lru(zone, page))
+				list_add(&page->lru, page_list);
+			else
+				rest++;
+		}
+		spin_unlock_irq(&zone->lru_lock);
+	}
+	return rest;
+}
+
 /*
  * Really, prep_compound_page() should be called from __rmqueue_bulk().  But
  * we cheat by calling it from here, in the order > 0 path.  Saves a branch
_
