Pages in a specified memory section are migrated when the section is removed. Signed-off-by: Hirokazu Takahashi Signed-off-by: Dave Hansen --- memhotplug-dave/mm/page_alloc.c | 48 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 45 insertions(+), 3 deletions(-) diff -puN mm/page_alloc.c~N1.0-memsection_migrate mm/page_alloc.c --- memhotplug/mm/page_alloc.c~N1.0-memsection_migrate 2005-07-28 13:51:15.000000000 -0700 +++ memhotplug-dave/mm/page_alloc.c 2005-07-28 13:51:15.000000000 -0700 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -798,6 +799,30 @@ static inline void force_captured_to_ina } } +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; +} + /* * Flags a given order of pages to be removed from memory, then removes any * of those pages that are currently in cpu cache or free lists. The page @@ -811,6 +836,9 @@ int capture_page_range(unsigned long sta struct page *page; int i; unsigned long nr_pages = 1<= 0) { - while (shrink_all_memory(10000)); + //while (shrink_all_memory(10000)); msleep(1000); } _