memory hotremove: unset migrate type "ISOLATE" after removal
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Thu, 15 Nov 2007 00:59:12 +0000 (16:59 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 15 Nov 2007 02:45:38 +0000 (18:45 -0800)
We should unset migrate type "ISOLATE" when we successfully removed memory.
 But current code has BUG and cannot works well.

This patch also includes bugfix?  to change get_pageblock_flags to
get_pageblock_migratetype().

Thanks to Badari Pulavarty for finding this.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memory_hotplug.c
mm/page_isolation.c

index 3a47871a29d909c561a4371f6afca71f59689126..987abe6375ed0ca65ee9b31b45433d583ce9db0b 100644 (file)
@@ -574,8 +574,8 @@ repeat:
        /* Ok, all of our target is islaoted.
           We cannot do rollback at this point. */
        offline_isolated_pages(start_pfn, end_pfn);
-       /* reset pagetype flags */
-       start_isolate_page_range(start_pfn, end_pfn);
+       /* reset pagetype flags and makes migrate type to be MOVABLE */
+       undo_isolate_page_range(start_pfn, end_pfn);
        /* removal success */
        zone->present_pages -= offlined_pages;
        zone->zone_pgdat->node_present_pages -= offlined_pages;
index 8f92a29695cc93e82e19582c998b6702ff5e9a2f..3444b58033c87e4263c1d2f1db79f8f416580a29 100644 (file)
@@ -55,7 +55,7 @@ start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
        return 0;
 undo:
        for (pfn = start_pfn;
-            pfn <= undo_pfn;
+            pfn < undo_pfn;
             pfn += pageblock_nr_pages)
                unset_migratetype_isolate(pfn_to_page(pfn));
 
@@ -76,7 +76,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
             pfn < end_pfn;
             pfn += pageblock_nr_pages) {
                page = __first_valid_page(pfn, pageblock_nr_pages);
-               if (!page || get_pageblock_flags(page) != MIGRATE_ISOLATE)
+               if (!page || get_pageblock_migratetype(page) != MIGRATE_ISOLATE)
                        continue;
                unset_migratetype_isolate(page);
        }
@@ -126,7 +126,7 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
         */
        for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) {
                page = __first_valid_page(pfn, pageblock_nr_pages);
-               if (page && get_pageblock_flags(page) != MIGRATE_ISOLATE)
+               if (page && get_pageblock_migratetype(page) != MIGRATE_ISOLATE)
                        break;
        }
        if (pfn < end_pfn)