mm: compaction: introduce map_pages()
authorMichal Nazarewicz <mina86@mina86.com>
Mon, 30 Jan 2012 12:23:47 +0000 (13:23 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 21 May 2012 13:09:28 +0000 (15:09 +0200)
This commit creates a map_pages() function which map pages freed
using split_free_pages().  This merely moves some code from
isolate_freepages() so that it can be reused in other places.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Tested-by: Robert Nelson <robertcnelson@gmail.com>
Tested-by: Barry Song <Baohua.Song@csr.com>
mm/compaction.c

index ee20fc044b91e57475b66dfdd66ea9e20b6c5106..d9d7b35d39330ab3644e0f40ae17cbd4a79b5793 100644 (file)
@@ -127,6 +127,16 @@ static bool suitable_migration_target(struct page *page)
        return false;
 }
 
+static void map_pages(struct list_head *list)
+{
+       struct page *page;
+
+       list_for_each_entry(page, list, lru) {
+               arch_alloc_page(page, 0);
+               kernel_map_pages(page, 1, 1);
+       }
+}
+
 /*
  * Based on information in the current compact_control, find blocks
  * suitable for isolating free pages from and then isolate them.
@@ -206,10 +216,7 @@ static void isolate_freepages(struct zone *zone,
        }
 
        /* split_free_page does not map the pages */
-       list_for_each_entry(page, freelist, lru) {
-               arch_alloc_page(page, 0);
-               kernel_map_pages(page, 1, 1);
-       }
+       map_pages(freelist);
 
        cc->free_pfn = high_pfn;
        cc->nr_freepages = nr_freepages;