Skip to content

Commit

Permalink
mm: compaction: ensure rescanning only happens on partially scanned p…
Browse files Browse the repository at this point in the history
…ageblocks

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]>
  • Loading branch information
gormanm authored and akpm00 committed Jun 9, 2023
1 parent 7bab8df commit 539aa04
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mm/compaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -2465,8 +2465,9 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)
* fast_find_migrateblock revisiting blocks that were
* recently partially scanned.
*/
if (cc->direct_compaction && !cc->finish_pageblock &&
(cc->mode < MIGRATE_SYNC)) {
if (!pageblock_aligned(cc->migrate_pfn) &&
cc->direct_compaction && !cc->finish_pageblock &&
(cc->mode < MIGRATE_SYNC)) {
cc->finish_pageblock = true;

/*
Expand Down

0 comments on commit 539aa04

Please sign in to comment.