diff options
author | Michal Nazarewicz <mina86@mina86.com> | 2011-12-29 07:09:50 -0500 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2012-05-21 09:09:32 -0400 |
commit | 47118af076f64844b4f423bc2f545b2da9dab50d (patch) | |
tree | 00df88cf2f60a2a3efc1a6c46ad88d128aee2071 /mm/compaction.c | |
parent | 6d4a49160de2c684fb59fa627bce80e200224331 (diff) |
mm: mmzone: MIGRATE_CMA migration type added
The MIGRATE_CMA migration type has two main characteristics:
(i) only movable pages can be allocated from MIGRATE_CMA
pageblocks and (ii) page allocator will never change migration
type of MIGRATE_CMA pageblocks.
This guarantees (to some degree) that page in a MIGRATE_CMA page
block can always be migrated somewhere else (unless there's no
memory left in the system).
It is designed to be used for allocating big chunks (eg. 10MiB)
of physically contiguous memory. Once driver requests
contiguous memory, pages from MIGRATE_CMA pageblocks may be
migrated away to create a contiguous block.
To minimise number of migrations, MIGRATE_CMA migration type
is the last type tried when page allocator falls back to other
migration types when requested.
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Tested-by: Rob Clark <rob.clark@linaro.org>
Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Tested-by: Robert Nelson <robertcnelson@gmail.com>
Tested-by: Barry Song <Baohua.Song@csr.com>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r-- | mm/compaction.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 7a92e418a187..da7d35ea5103 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -45,6 +45,11 @@ static void map_pages(struct list_head *list) | |||
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | static inline bool migrate_async_suitable(int migratetype) | ||
49 | { | ||
50 | return is_migrate_cma(migratetype) || migratetype == MIGRATE_MOVABLE; | ||
51 | } | ||
52 | |||
48 | /* | 53 | /* |
49 | * Isolate free pages onto a private freelist. Caller must hold zone->lock. | 54 | * Isolate free pages onto a private freelist. Caller must hold zone->lock. |
50 | * If @strict is true, will abort returning 0 on any invalid PFNs or non-free | 55 | * If @strict is true, will abort returning 0 on any invalid PFNs or non-free |
@@ -299,7 +304,7 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, | |||
299 | */ | 304 | */ |
300 | pageblock_nr = low_pfn >> pageblock_order; | 305 | pageblock_nr = low_pfn >> pageblock_order; |
301 | if (!cc->sync && last_pageblock_nr != pageblock_nr && | 306 | if (!cc->sync && last_pageblock_nr != pageblock_nr && |
302 | get_pageblock_migratetype(page) != MIGRATE_MOVABLE) { | 307 | !migrate_async_suitable(get_pageblock_migratetype(page))) { |
303 | low_pfn += pageblock_nr_pages; | 308 | low_pfn += pageblock_nr_pages; |
304 | low_pfn = ALIGN(low_pfn, pageblock_nr_pages) - 1; | 309 | low_pfn = ALIGN(low_pfn, pageblock_nr_pages) - 1; |
305 | last_pageblock_nr = pageblock_nr; | 310 | last_pageblock_nr = pageblock_nr; |
@@ -367,8 +372,8 @@ static bool suitable_migration_target(struct page *page) | |||
367 | if (PageBuddy(page) && page_order(page) >= pageblock_order) | 372 | if (PageBuddy(page) && page_order(page) >= pageblock_order) |
368 | return true; | 373 | return true; |
369 | 374 | ||
370 | /* If the block is MIGRATE_MOVABLE, allow migration */ | 375 | /* If the block is MIGRATE_MOVABLE or MIGRATE_CMA, allow migration */ |
371 | if (migratetype == MIGRATE_MOVABLE) | 376 | if (migrate_async_suitable(migratetype)) |
372 | return true; | 377 | return true; |
373 | 378 | ||
374 | /* Otherwise skip the block */ | 379 | /* Otherwise skip the block */ |