Skip to content

Commit

Permalink
mm: compaction: introduce map_pages()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Marek Szyprowski <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
Tested-by: Robert Nelson <[email protected]>
Tested-by: Barry Song <[email protected]>
  • Loading branch information
mina86 authored and mszyprow committed May 21, 2012
1 parent 2fe86e0 commit 03d4419
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions mm/compaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 03d4419

Please sign in to comment.