
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---

 memhotplug-dave/mm/page_alloc.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff -puN mm/page_alloc.c~K6-capture-pages-cleanup mm/page_alloc.c
--- memhotplug/mm/page_alloc.c~K6-capture-pages-cleanup	2005-04-13 14:21:04.000000000 -0700
+++ memhotplug-dave/mm/page_alloc.c	2005-04-13 14:21:04.000000000 -0700
@@ -730,13 +730,9 @@ int capture_page_range(unsigned long sta
 	int fup;
 	struct page *page;
 	int i;
-	unsigned long nr_pages;
+	unsigned long nr_pages = 1<<order;
 
-	/* If the start_pfn is not aligned with the order return failure */
-	if (start_pfn % (1 << order) != 0)
-		return -EINVAL;
-
-	for (i = 0; i < (1 << order); i++)
+	for (i = 0; i < nr_pages; i++)
 		set_page_under_capture(pfn_to_page(start_pfn + i));
 	/*
 	 * the set_page_under_capture() operations are not barriers, so
@@ -753,16 +749,14 @@ int capture_page_range(unsigned long sta
 	page = pfn_to_page(start_pfn);
 	remove_page_freearea(page, order);
 	force_captured_to_inactive_list(page);
-	nr_pages = 1<<order;
 	/*
 	 * storing the last result (fp) keeps up from having
 	 * to walk the entire range each time
 	 */
 	fup = start_pfn;
-	while((fup = first_uncaptured_page(fup, nr_pages)) >= 0) {
-		if (i++ < 100)
-			while (shrink_all_memory(10000));
-		msleep(100);
+	while((fup = first_uncaptured_page(fup, nr_pages - (fup - start_pfn))) >= 0) {
+		while (shrink_all_memory(10000));
+		msleep(1000);
 	}
 
 	return 0;
_
