Commit 700c2a46 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov Committed by Linus Torvalds

mem-hotplug: call isolate_lru_page with elevated refcount

isolate_lru_page() must be called only with stable reference to page.  So,
let's grab normal page reference.
Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 22943ab1
...@@ -706,7 +706,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) ...@@ -706,7 +706,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
if (!pfn_valid(pfn)) if (!pfn_valid(pfn))
continue; continue;
page = pfn_to_page(pfn); page = pfn_to_page(pfn);
if (!page_count(page)) if (!get_page_unless_zero(page))
continue; continue;
/* /*
* We can skip free pages. And we can only deal with pages on * We can skip free pages. And we can only deal with pages on
...@@ -714,6 +714,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) ...@@ -714,6 +714,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
*/ */
ret = isolate_lru_page(page); ret = isolate_lru_page(page);
if (!ret) { /* Success */ if (!ret) { /* Success */
put_page(page);
list_add_tail(&page->lru, &source); list_add_tail(&page->lru, &source);
move_pages--; move_pages--;
inc_zone_page_state(page, NR_ISOLATED_ANON + inc_zone_page_state(page, NR_ISOLATED_ANON +
...@@ -725,6 +726,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) ...@@ -725,6 +726,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
pfn); pfn);
dump_page(page); dump_page(page);
#endif #endif
put_page(page);
/* Because we don't have big zone->lock. we should /* Because we don't have big zone->lock. we should
check this again here. */ check this again here. */
if (page_count(page)) { if (page_count(page)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment