From: Konstantin Khlebnikov Date: Wed, 25 May 2011 00:12:19 +0000 (-0700) Subject: mem-hotplug: call isolate_lru_page with elevated refcount X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=700c2a46e88265326764197d5b8842490bae5569;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: Konstantin Khlebnikov Cc: Andi Kleen Cc: KAMEZAWA Hiroyuki Cc: KOSAKI Motohiro Cc: Mel Gorman Cc: Lee Schermerhorn Cc: Rik van Riel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 59ac18fefd65..89b0391f14a8 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -706,7 +706,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) if (!pfn_valid(pfn)) continue; page = pfn_to_page(pfn); - if (!page_count(page)) + if (!get_page_unless_zero(page)) continue; /* * 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) */ ret = isolate_lru_page(page); if (!ret) { /* Success */ + put_page(page); list_add_tail(&page->lru, &source); move_pages--; inc_zone_page_state(page, NR_ISOLATED_ANON + @@ -725,6 +726,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) pfn); dump_page(page); #endif + put_page(page); /* Because we don't have big zone->lock. we should check this again here. */ if (page_count(page)) {