Skip to content

Commit 6d7ce55

Browse files
rientjestorvalds
authored andcommitted
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>
1 parent 43e7a34 commit 6d7ce55

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎mm/compaction.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,8 +1032,8 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
10321032
return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE;
10331033
}
10341034

1035-
static int compact_finished(struct zone *zone,
1036-
struct compact_control *cc)
1035+
static int compact_finished(struct zone *zone, struct compact_control *cc,
1036+
const int migratetype)
10371037
{
10381038
unsigned int order;
10391039
unsigned long watermark;
@@ -1079,7 +1079,7 @@ static int compact_finished(struct zone *zone,
10791079
struct free_area *area = &zone->free_area[order];
10801080

10811081
/* 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]))
10831083
return COMPACT_PARTIAL;
10841084

10851085
/* Job done if allocation would set block type */
@@ -1145,6 +1145,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
11451145
int ret;
11461146
unsigned long start_pfn = zone->zone_start_pfn;
11471147
unsigned long end_pfn = zone_end_pfn(zone);
1148+
const int migratetype = gfpflags_to_migratetype(cc->gfp_mask);
11481149
const bool sync = cc->mode != MIGRATE_ASYNC;
11491150

11501151
ret = compaction_suitable(zone, cc->order);
@@ -1187,7 +1188,8 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
11871188

11881189
migrate_prep_local();
11891190

1190-
while ((ret = compact_finished(zone, cc)) == COMPACT_CONTINUE) {
1191+
while ((ret = compact_finished(zone, cc, migratetype)) ==
1192+
COMPACT_CONTINUE) {
11911193
int err;
11921194

11931195
switch (isolate_migratepages(zone, cc)) {
@@ -1242,7 +1244,7 @@ static unsigned long compact_zone_order(struct zone *zone, int order,
12421244
.nr_freepages = 0,
12431245
.nr_migratepages = 0,
12441246
.order = order,
1245-
.migratetype = gfpflags_to_migratetype(gfp_mask),
1247+
.gfp_mask = gfp_mask,
12461248
.zone = zone,
12471249
.mode = mode,
12481250
};

‎mm/internal.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ struct compact_control {
142142
bool finished_update_migrate;
143143

144144
int order; /* order a direct compactor needs */
145-
int migratetype; /* MOVABLE, RECLAIMABLE etc */
145+
const gfp_t gfp_mask; /* gfp mask of a direct compactor */
146146
struct zone *zone;
147147
int contended; /* Signal need_sched() or lock
148148
* contention detected during

0 commit comments

Comments
 (0)