Skip to content

Commit 195b0c6

Browse files
Gioh-Kimtorvalds
authored andcommitted
mm/compaction: reset compaction scanner positions
When the compaction is activated via /proc/sys/vm/compact_memory it would better scan the whole zone. And some platforms, for instance ARM, have the start_pfn of a zone at zero. Therefore the first try to compact via /proc doesn't work. It needs to reset the compaction scanner position first. Signed-off-by: Gioh Kim <gioh.kim@lge.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: David Rientjes <rientjes@google.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Mel Gorman <mel@csn.ul.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 3b36369 commit 195b0c6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mm/compaction.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,14 @@ static void __compact_pgdat(pg_data_t *pgdat, struct compact_control *cc)
16051605
INIT_LIST_HEAD(&cc->freepages);
16061606
INIT_LIST_HEAD(&cc->migratepages);
16071607

1608+
/*
1609+
* When called via /proc/sys/vm/compact_memory
1610+
* this makes sure we compact the whole zone regardless of
1611+
* cached scanner positions.
1612+
*/
1613+
if (cc->order == -1)
1614+
__reset_isolation_suitable(zone);
1615+
16081616
if (cc->order == -1 || !compaction_deferred(zone, cc->order))
16091617
compact_zone(zone, cc);
16101618

0 commit comments

Comments
 (0)