]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm/page_alloc: refactor out __alloc_contig_migrate_alloc()
authorMinchan Kim <minchan@kernel.org>
Fri, 28 Sep 2012 00:19:49 +0000 (10:19 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Oct 2012 05:03:31 +0000 (15:03 +1000)
__alloc_contig_migrate_alloc() can be used by memory-hotplug so refactor
it out (move + rename as a common name) into page_isolation.c.

Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/page-isolation.h
mm/page_alloc.c
mm/page_isolation.c

index fca8c0a5c1883d6079d39d5e11a7ca0b9fc4bc39..76a9539cfd3f629403b66e2daaf9c6b5ffbcef1b 100644 (file)
@@ -41,6 +41,7 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn);
  */
 int set_migratetype_isolate(struct page *page);
 void unset_migratetype_isolate(struct page *page, unsigned migratetype);
-
+struct page *alloc_migrate_target(struct page *page, unsigned long private,
+                               int **resultp);
 
 #endif
index deadd1c93041560387978e7574c3bae81c209d45..6d28b738e3f8f04b6c90bc1d605a3d80d37b8200 100644 (file)
@@ -5666,18 +5666,6 @@ static unsigned long pfn_max_align_up(unsigned long pfn)
                                pageblock_nr_pages));
 }
 
-static struct page *
-__alloc_contig_migrate_alloc(struct page *page, unsigned long private,
-                            int **resultp)
-{
-       gfp_t gfp_mask = GFP_USER | __GFP_MOVABLE;
-
-       if (PageHighMem(page))
-               gfp_mask |= __GFP_HIGHMEM;
-
-       return alloc_page(gfp_mask);
-}
-
 /* [start, end) must belong to a single zone. */
 static int __alloc_contig_migrate_range(unsigned long start, unsigned long end)
 {
@@ -5721,7 +5709,7 @@ static int __alloc_contig_migrate_range(unsigned long start, unsigned long end)
                reclaim_clean_pages_from_list(cc.zone, &cc.migratepages);
 
                ret = migrate_pages(&cc.migratepages,
-                                   __alloc_contig_migrate_alloc,
+                                   alloc_migrate_target,
                                    0, false, MIGRATE_SYNC);
        }
 
index 5f34a9053ce0028d275fef67a07837166138dd54..5225799eb20496c04df9b0ff216cffaa3ea44d2e 100644 (file)
@@ -255,3 +255,14 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
        spin_unlock_irqrestore(&zone->lock, flags);
        return ret ? 0 : -EBUSY;
 }
+
+struct page *alloc_migrate_target(struct page *page, unsigned long private,
+                             int **resultp)
+{
+        gfp_t gfp_mask = GFP_USER | __GFP_MOVABLE;
+
+        if (PageHighMem(page))
+                gfp_mask |= __GFP_HIGHMEM;
+
+        return alloc_page(gfp_mask);
+}