mm, compaction: change migrate_async_suitable() to suitable_migration_source()
Subsystems (4)
[email protected]
maintainerPATCH 5/114 mm, compaction: change migrate_async_suitable() to suitable_migration_source()
From: Vlastimil Babka <[email protected]>
Subject: mm, compaction: change migrate_async_suitable() to suitable_migration_source()
Preparation for making the decisions more complex and depending on compact_control flags. No functional change.
Signed-off-by Vlastimil Babka <[email protected]>
Acked-by Mel Gorman <[email protected]>
Acked-by Johannes Weiner <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc David Rientjes <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
include/linux/mmzone.h | 5 +++++ mm/compaction.c | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-)
include/linux/mmzone.h renamed from include/linux/mmzone.h~mm-compaction-change-migrate_async_suitable-to-suitable_migration_source +5 -0
@@ -74,6 +74,11 @@ extern char * const migratetype_names[MI# define is_migrate_cma_page (_page) false#endif +static inline bool is_migrate_movable (int mt) +{ +return is_migrate_cma (mt) || mt ==MIGRATE_MOVABLE ; +} +#define for_each_migratetype_order (order, type) \ for (order = 0; order < MAX_ORDER; order++) \ for (type = 0; type < MIGRATE_TYPES; type++)
mm/compaction.c renamed from mm/compaction.c~mm-compaction-change-migrate_async_suitable-to-suitable_migration_source +11 -8
@@ -89,11 +89,6 @@ static void map_pages(struct list_head *list_splice (&tmp_list, list); } -static inline bool migrate_async_suitable (int migratetype) -{ -return is_migrate_cma (migratetype) || migratetype ==MIGRATE_MOVABLE ; -} -#ifdef CONFIG_COMPACTION int PageMovable (struct page *page)
@@ -988,6 +983,15 @@ isolate_migratepages_range(struct compac#endif /* CONFIG_COMPACTION || CONFIG_CMA */ #ifdef CONFIG_COMPACTION +static bool suitable_migration_source (struct compact_control *cc, +struct page *page) +{ +if (cc->mode !=MIGRATE_ASYNC ) +return true; + +return is_migrate_movable (get_pageblock_migratetype (page)); +} +/* Returns true if the page is within a block suitable for migration to */ static bool suitable_migration_target (struct compact_control *cc,struct page *page)
@@ -1007,7 +1011,7 @@ static bool suitable_migration_target(streturn true;/* If the block is MIGRATE_MOVABLE or MIGRATE_CMA, allow migration */ -if (migrate_async_suitable (get_pageblock_migratetype (page))) +if (is_migrate_movable (get_pageblock_migratetype (page)))return true;/* Otherwise skip the block */
@@ -1242,8 +1246,7 @@ static isolate_migrate_t isolate_migrate* Async compaction is optimistic to see if the minimum amount * of work satisfies the allocation. */ -if (cc->mode ==MIGRATE_ASYNC && - !migrate_async_suitable (get_pageblock_migratetype (page))) +if (!suitable_migration_source (cc, page))continue ;/* Perform the isolation */
_