提交 dbc0e4ce 编写于 作者: K KAMEZAWA Hiroyuki 提交者: Linus Torvalds

memory hotremove: unset migrate type "ISOLATE" after removal

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: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: NBadari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 3ad33b24
...@@ -574,8 +574,8 @@ int offline_pages(unsigned long start_pfn, ...@@ -574,8 +574,8 @@ int offline_pages(unsigned long start_pfn,
/* Ok, all of our target is islaoted. /* Ok, all of our target is islaoted.
We cannot do rollback at this point. */ We cannot do rollback at this point. */
offline_isolated_pages(start_pfn, end_pfn); offline_isolated_pages(start_pfn, end_pfn);
/* reset pagetype flags */ /* reset pagetype flags and makes migrate type to be MOVABLE */
start_isolate_page_range(start_pfn, end_pfn); undo_isolate_page_range(start_pfn, end_pfn);
/* removal success */ /* removal success */
zone->present_pages -= offlined_pages; zone->present_pages -= offlined_pages;
zone->zone_pgdat->node_present_pages -= offlined_pages; zone->zone_pgdat->node_present_pages -= offlined_pages;
......
...@@ -55,7 +55,7 @@ start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn) ...@@ -55,7 +55,7 @@ start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
return 0; return 0;
undo: undo:
for (pfn = start_pfn; for (pfn = start_pfn;
pfn <= undo_pfn; pfn < undo_pfn;
pfn += pageblock_nr_pages) pfn += pageblock_nr_pages)
unset_migratetype_isolate(pfn_to_page(pfn)); unset_migratetype_isolate(pfn_to_page(pfn));
...@@ -76,7 +76,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn) ...@@ -76,7 +76,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
pfn < end_pfn; pfn < end_pfn;
pfn += pageblock_nr_pages) { pfn += pageblock_nr_pages) {
page = __first_valid_page(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; continue;
unset_migratetype_isolate(page); unset_migratetype_isolate(page);
} }
...@@ -126,7 +126,7 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn) ...@@ -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) { for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) {
page = __first_valid_page(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; break;
} }
if (pfn < end_pfn) if (pfn < end_pfn)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册