Skip to content

Commit 539aa04

Browse files
gormanmakpm00
authored andcommitted
mm: compaction: ensure rescanning only happens on partially scanned pageblocks
Patch series "Follow-up "Fix excessive CPU usage during compaction"". The series "Fix excessive CPU usage during compaction" [1] attempted to fix a bug [2] but Vlastimil noted that the fix was incomplete [3]. While the series was merged, fast_find_migrateblock was still disabled. This series should fix the corner cases and allow 95e7a45 ("Revert "mm/compaction: fix set skip in fast_find_migrateblock"") to be safely reverted. Details on how many pageblocks are rescanned are in the changelog of the last patch. "Raghavendra K T" tested this and reported "decent improvement from perf perspective as well as compaction related data [4] [1] https://lore.kernel.org/r/[email protected] [2] https://bugzilla.suse.com/show_bug.cgi?id=1206848 [3] https://lore.kernel.org/r/[email protected] [4] https://lkml.kernel.org/r/[email protected] This patch (of 4): compact_zone() intends to rescan pageblocks if there is a failure to migrate "within the current order-aligned block". However, the pageblock scan may already be complete and moved to the next block causing the next pageblock to be "rescanned". Ensure only the most recent pageblock is rescanned. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Mel Gorman <[email protected]> Reported-by: Vlastimil Babka <[email protected]> Tested-by: Raghavendra K T <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Cc: Chuyi Zhou <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Maxim Levitsky <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Pedro Falcato <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 7bab8df commit 539aa04

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mm/compaction.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,8 +2465,9 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)
24652465
* fast_find_migrateblock revisiting blocks that were
24662466
* recently partially scanned.
24672467
*/
2468-
if (cc->direct_compaction && !cc->finish_pageblock &&
2469-
(cc->mode < MIGRATE_SYNC)) {
2468+
if (!pageblock_aligned(cc->migrate_pfn) &&
2469+
cc->direct_compaction && !cc->finish_pageblock &&
2470+
(cc->mode < MIGRATE_SYNC)) {
24702471
cc->finish_pageblock = true;
24712472

24722473
/*

0 commit comments

Comments
 (0)