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

 memhotplug-dave/mm/page_alloc.c |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)

diff -puN mm/page_alloc.c~K5-compile-fixes mm/page_alloc.c
--- memhotplug/mm/page_alloc.c~K5-compile-fixes	2005-04-13 14:21:04.000000000 -0700
+++ memhotplug-dave/mm/page_alloc.c	2005-04-13 14:21:04.000000000 -0700
@@ -374,7 +374,7 @@ static inline void extract_pages(struct 
 	area->nr_free--;
 }
 
-#ifdef CONFIG_MEMORY_HOTPLUG
+#ifdef CONFIG_MEMORY_REMOVE
 /*
  * Called when trying to allocate or free a page that has been marked for
  * removal.
@@ -445,7 +445,7 @@ static int remove_page_freearea(struct p
 static inline void capture_pages(struct page *page, int order)
 {
 }
-#endif /* CONFIG_MEMORY_HOTPLUG */
+#endif /* CONFIG_MEMORY_REMOVE */
 
 void __free_pages_ok(struct page *page, unsigned int order)
 {
@@ -601,7 +601,7 @@ static int rmqueue_bulk(struct zone *zon
 	return allocated;
 }
 
-#if defined(CONFIG_PM) || defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_MEMORY_HOTPLUG)
+#if defined(CONFIG_PM) || defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_MEMORY_REMOVE)
 static void __drain_pages(unsigned int cpu)
 {
 	struct zone *zone;
@@ -620,7 +620,7 @@ static void __drain_pages(unsigned int c
 		}
 	}
 }
-#endif /* CONFIG_PM || CONFIG_HOTPLUG_CPU || CONFIG_MEMORY_HOTPLUG */
+#endif /* CONFIG_PM || CONFIG_HOTPLUG_CPU || CONFIG_MEMORY_REMOVE */
 
 #ifdef CONFIG_PM
 
@@ -650,7 +650,7 @@ void mark_free_pages(struct zone *zone)
 }
 #endif /* CONFIG_PM */
 
-#if defined(CONFIG_PM) || defined(CONFIG_MEMORY_HOTPLUG)
+#if defined(CONFIG_PM) || defined(CONFIG_MEMORY_REMOVE)
 
 /*
  * Spill all of this CPU's per-cpu pages back into the buddy allocator.
@@ -663,14 +663,15 @@ void drain_local_pages(void)
 	__drain_pages(smp_processor_id());
 	local_irq_restore(flags);	
 }
-#endif /* CONFIG_PM  || CONFIG_MEMORY_HOTPLUG */
+#endif /* CONFIG_PM  || CONFIG_MEMORY_REMOVE */
 
-#ifdef CONFIG_MEMORY_HOTPLUG
+#ifdef CONFIG_MEMORY_REMOVE
 static inline int first_uncaptured_page(unsigned long start_pfn, int nr_pages)
 {
 	int i;
 	int res = -1;
-	int count = 0;;
+	int count = 0;
+	unsigned long end_pfn = start_pfn + nr_pages;
 
 	printk(KERN_DEBUG "%s(%ld, %d) begin\n",
 			__func__, start_pfn, nr_pages);
@@ -730,7 +731,6 @@ int capture_page_range(unsigned long sta
 	struct page *page;
 	int i;
 	unsigned long nr_pages;
-	unsigned long end_pfn;
 
 	/* If the start_pfn is not aligned with the order return failure */
 	if (start_pfn % (1 << order) != 0)
@@ -759,8 +759,7 @@ int capture_page_range(unsigned long sta
 	 * to walk the entire range each time
 	 */
 	fup = start_pfn;
-	end_pfn = start_pfn + nr_pages;
-	while((fp = first_uncaptured_page(fup, end_pfn)) >= 0) {
+	while((fup = first_uncaptured_page(fup, nr_pages)) >= 0) {
 		if (i++ < 100)
 			while (shrink_all_memory(10000));
 		msleep(100);
@@ -769,12 +768,12 @@ int capture_page_range(unsigned long sta
 	return 0;
 }
 
-#else /* CONFIG_MEMORY_HOTPLUG */
-int capture_page_range(unsigned long pfn, unsigned long size)
+#else /* CONFIG_MEMORY_REMOVE */
+int capture_page_range(unsigned long pfn, int order)
 {
 	return -ENOSYS;
 }
-#endif /* CONFIG_MEMORY_HOTPLUG */
+#endif /* CONFIG_MEMORY_REMOVE */
 
 static void zone_statistics(struct zonelist *zonelist, struct zone *z)
 {
_
