summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/mmzone.h5
-rw-r--r--mm/compaction.c19
2 files changed, 16 insertions, 8 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index e0c3c5e3d8a0..ebaccd4e7d8c 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -74,6 +74,11 @@ extern char * const migratetype_names[MIGRATE_TYPES];
74# define is_migrate_cma_page(_page) false 74# define is_migrate_cma_page(_page) false
75#endif 75#endif
76 76
77static inline bool is_migrate_movable(int mt)
78{
79 return is_migrate_cma(mt) || mt == MIGRATE_MOVABLE;
80}
81
77#define for_each_migratetype_order(order, type) \ 82#define for_each_migratetype_order(order, type) \
78 for (order = 0; order < MAX_ORDER; order++) \ 83 for (order = 0; order < MAX_ORDER; order++) \
79 for (type = 0; type < MIGRATE_TYPES; type++) 84 for (type = 0; type < MIGRATE_TYPES; type++)
diff --git a/mm/compaction.c b/mm/compaction.c
index 01b1fb8f6f47..a20876e37648 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -89,11 +89,6 @@ static void map_pages(struct list_head *list)
89 list_splice(&tmp_list, list); 89 list_splice(&tmp_list, list);
90} 90}
91 91
92static inline bool migrate_async_suitable(int migratetype)
93{
94 return is_migrate_cma(migratetype) || migratetype == MIGRATE_MOVABLE;
95}
96
97#ifdef CONFIG_COMPACTION 92#ifdef CONFIG_COMPACTION
98 93
99int PageMovable(struct page *page) 94int PageMovable(struct page *page)
@@ -988,6 +983,15 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn,
988#endif /* CONFIG_COMPACTION || CONFIG_CMA */ 983#endif /* CONFIG_COMPACTION || CONFIG_CMA */
989#ifdef CONFIG_COMPACTION 984#ifdef CONFIG_COMPACTION
990 985
986static bool suitable_migration_source(struct compact_control *cc,
987 struct page *page)
988{
989 if (cc->mode != MIGRATE_ASYNC)
990 return true;
991
992 return is_migrate_movable(get_pageblock_migratetype(page));
993}
994
991/* Returns true if the page is within a block suitable for migration to */ 995/* Returns true if the page is within a block suitable for migration to */
992static bool suitable_migration_target(struct compact_control *cc, 996static bool suitable_migration_target(struct compact_control *cc,
993 struct page *page) 997 struct page *page)
@@ -1007,7 +1011,7 @@ static bool suitable_migration_target(struct compact_control *cc,
1007 return true; 1011 return true;
1008 1012
1009 /* If the block is MIGRATE_MOVABLE or MIGRATE_CMA, allow migration */ 1013 /* If the block is MIGRATE_MOVABLE or MIGRATE_CMA, allow migration */
1010 if (migrate_async_suitable(get_pageblock_migratetype(page))) 1014 if (is_migrate_movable(get_pageblock_migratetype(page)))
1011 return true; 1015 return true;
1012 1016
1013 /* Otherwise skip the block */ 1017 /* Otherwise skip the block */
@@ -1242,8 +1246,7 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
1242 * Async compaction is optimistic to see if the minimum amount 1246 * Async compaction is optimistic to see if the minimum amount
1243 * of work satisfies the allocation. 1247 * of work satisfies the allocation.
1244 */ 1248 */
1245 if (cc->mode == MIGRATE_ASYNC && 1249 if (!suitable_migration_source(cc, page))
1246 !migrate_async_suitable(get_pageblock_migratetype(page)))
1247 continue; 1250 continue;
1248 1251
1249 /* Perform the isolation */ 1252 /* Perform the isolation */