

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

 memhotplug-dave/include/linux/mmigrate.h |    3 ++-
 memhotplug-dave/mm/mmigrate.c            |   13 ++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff -puN include/linux/mmigrate.h~AA-PM-31-make_migrate_onepage_take_node include/linux/mmigrate.h
--- memhotplug/include/linux/mmigrate.h~AA-PM-31-make_migrate_onepage_take_node	2005-03-28 16:38:30.000000000 -0800
+++ memhotplug-dave/include/linux/mmigrate.h	2005-03-28 16:38:30.000000000 -0800
@@ -4,6 +4,7 @@
 #include <linux/config.h>
 #include <linux/mm.h>
 
+#define MIGRATE_NODE_ANY -1
 
 #ifdef CONFIG_MEMORY_MIGRATE
 extern int generic_migrate_page(struct page *, struct page *,
@@ -14,7 +15,7 @@ extern int migrate_page_buffer(struct pa
 					struct list_head *);
 extern int page_migratable(struct page *, struct page *, int,
 					struct list_head *);
-extern struct page * migrate_onepage(struct page *);
+extern struct page * migrate_onepage(struct page *, int nodeid);
 extern int try_to_migrate_pages(struct list_head *);
 
 #else
diff -puN mm/mmigrate.c~AA-PM-31-make_migrate_onepage_take_node mm/mmigrate.c
--- memhotplug/mm/mmigrate.c~AA-PM-31-make_migrate_onepage_take_node	2005-03-28 16:38:30.000000000 -0800
+++ memhotplug-dave/mm/mmigrate.c	2005-03-28 16:38:30.000000000 -0800
@@ -403,7 +403,7 @@ out_removing:
  * swapcache or anonymous memory.
  */
 struct page *
-migrate_onepage(struct page *page)
+migrate_onepage(struct page *page, int nodeid)
 {
 	struct page *newpage;
 	struct address_space *mapping;
@@ -433,7 +433,10 @@ migrate_onepage(struct page *page)
 	 * Allocate a new page with the same gfp_mask
 	 * as the target page has.
 	 */
-	newpage = page_cache_alloc(mapping);
+	if (nodeid == MIGRATE_NODE_ANY)
+		newpage = page_cache_alloc(mapping);
+	else
+		newpage = alloc_pages_node(nodeid, mapping->flags, 0);
 	if (newpage == NULL) {
 		unlock_page(page);
 		return ERR_PTR(-ENOMEM);
@@ -538,7 +541,7 @@ int try_to_migrate_pages(struct list_hea
 	list_for_each_entry_safe(page, page2, &pass1_list, lru) {
 		list_del(&page->lru);
 		if (PageLocked(page) || PageWriteback(page) ||
-		    IS_ERR(newpage = migrate_onepage(page))) {
+		    IS_ERR(newpage = migrate_onepage(page, MIGRATE_NODE_ANY))) {
 			if (page_count(page) == 1) {
 				/* the page is already unused */
 				putback_page_to_lru(page_zone(page), page);
@@ -556,7 +559,7 @@ int try_to_migrate_pages(struct list_hea
 	 */
 	list_for_each_entry_safe(page, page2, &pass2_list, lru) {
 		list_del(&page->lru);
-		if (IS_ERR(newpage = migrate_onepage(page))) {
+		if (IS_ERR(newpage = migrate_onepage(page, MIGRATE_NODE_ANY))) {
 			if (page_count(page) == 1) {
 				/* the page is already unused */
 				putback_page_to_lru(page_zone(page), page);
@@ -586,4 +589,4 @@ EXPORT_SYMBOL(generic_migrate_page);
 EXPORT_SYMBOL(migrate_page_common);
 EXPORT_SYMBOL(migrate_page_buffer);
 EXPORT_SYMBOL(page_migratable);
-
+EXPORT_SYMBOL(migrate_onepage);
_
