| From dhobsong@igel.co.jp Mon Oct 29 00:51:53 2012 |
| From: Damian Hobson-Garcia <dhobsong@igel.co.jp> |
| Date: Mon, 29 Oct 2012 16:50:20 +0900 |
| Subject: [PATCH v2 03/58] mm: compaction: introduce map_pages() |
| To: greg@kroah.com, laurent.pinchart@ideasonboard.com, horms@verge.net.au |
| Cc: ltsi-dev@lists.linuxfoundation.org, dhobsong@igel.co.jp |
| Message-ID: <1351497075-32717-4-git-send-email-dhobsong@igel.co.jp> |
| |
| |
| From: Michal Nazarewicz <mina86@mina86.com> |
| |
| 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> |
| (cherry picked from commit 03d44192f69a45d780ba124f691e76020a44ebae) |
| |
| Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp> |
| Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
| --- |
| mm/compaction.c | 15 +++++++++++---- |
| 1 files changed, 11 insertions(+), 4 deletions(-) |
| |
| diff --git a/mm/compaction.c b/mm/compaction.c |
| index 0304ff6..f740488 100644 |
| --- a/mm/compaction.c |
| +++ b/mm/compaction.c |
| @@ -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; |
| -- |
| 1.7.5.4 |
| |