summaryrefslogtreecommitdiffstats
path: root/mm/compaction.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2014-10-09 18:27:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-09 22:25:55 -0400
commit6d7ce55940b6ecd463ca044ad241f0122d913293 (patch)
tree9b085af7aca9c01fc7866bbf047f13b1771b3979 /mm/compaction.c
parent43e7a34d265e884b7cf34f9b05e6f2e0c05bf120 (diff)
mm, compaction: pass gfp mask to compact_control
struct compact_control currently converts the gfp mask to a migratetype, but we need the entire gfp mask in a follow-up patch. Pass the entire gfp mask as part of struct compact_control. Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Acked-by: Minchan Kim <minchan@kernel.org> Acked-by: Mel Gorman <mgorman@suse.de> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Michal Nazarewicz <mina86@mina86.com> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Christoph Lameter <cl@linux.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r--mm/compaction.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index 7c687c0eef6e..15163b4b35ab 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1032,8 +1032,8 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
1032 return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE; 1032 return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE;
1033} 1033}
1034 1034
1035static int compact_finished(struct zone *zone, 1035static int compact_finished(struct zone *zone, struct compact_control *cc,
1036 struct compact_control *cc) 1036 const int migratetype)
1037{ 1037{
1038 unsigned int order; 1038 unsigned int order;
1039 unsigned long watermark; 1039 unsigned long watermark;
@@ -1079,7 +1079,7 @@ static int compact_finished(struct zone *zone,
1079 struct free_area *area = &zone->free_area[order]; 1079 struct free_area *area = &zone->free_area[order];
1080 1080
1081 /* Job done if page is free of the right migratetype */ 1081 /* Job done if page is free of the right migratetype */
1082 if (!list_empty(&area->free_list[cc->migratetype])) 1082 if (!list_empty(&area->free_list[migratetype]))
1083 return COMPACT_PARTIAL; 1083 return COMPACT_PARTIAL;
1084 1084
1085 /* Job done if allocation would set block type */ 1085 /* Job done if allocation would set block type */
@@ -1145,6 +1145,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
1145 int ret; 1145 int ret;
1146 unsigned long start_pfn = zone->zone_start_pfn; 1146 unsigned long start_pfn = zone->zone_start_pfn;
1147 unsigned long end_pfn = zone_end_pfn(zone); 1147 unsigned long end_pfn = zone_end_pfn(zone);
1148 const int migratetype = gfpflags_to_migratetype(cc->gfp_mask);
1148 const bool sync = cc->mode != MIGRATE_ASYNC; 1149 const bool sync = cc->mode != MIGRATE_ASYNC;
1149 1150
1150 ret = compaction_suitable(zone, cc->order); 1151 ret = compaction_suitable(zone, cc->order);
@@ -1187,7 +1188,8 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
1187 1188
1188 migrate_prep_local(); 1189 migrate_prep_local();
1189 1190
1190 while ((ret = compact_finished(zone, cc)) == COMPACT_CONTINUE) { 1191 while ((ret = compact_finished(zone, cc, migratetype)) ==
1192 COMPACT_CONTINUE) {
1191 int err; 1193 int err;
1192 1194
1193 switch (isolate_migratepages(zone, cc)) { 1195 switch (isolate_migratepages(zone, cc)) {
@@ -1242,7 +1244,7 @@ static unsigned long compact_zone_order(struct zone *zone, int order,
1242 .nr_freepages = 0, 1244 .nr_freepages = 0,
1243 .nr_migratepages = 0, 1245 .nr_migratepages = 0,
1244 .order = order, 1246 .order = order,
1245 .migratetype = gfpflags_to_migratetype(gfp_mask), 1247 .gfp_mask = gfp_mask,
1246 .zone = zone, 1248 .zone = zone,
1247 .mode = mode, 1249 .mode = mode,
1248 }; 1250 };