Commit 9ecc5fc5 authored by Mel Gorman's avatar Mel Gorman Committed by Andrew Morton

mm: compaction: only force pageblock scan completion when skip hints are obeyed

fast_find_migrateblock relies on skip hints to avoid rescanning a recently
selected pageblock but compact_zone() only forces the pageblock scan
completion to set the skip hint if in direct compaction.  While this
prevents direct compaction repeatedly scanning a subset of blocks due to
fast_find_migrateblock(), it does not prevent proactive compaction, node
compaction and kcompactd encountering the same problem described in commit
cfccd2e6 ("mm, compaction: finish pageblocks on complete migration
failure").

Force the scan completion of a pageblock to set the skip hint if skip
hints are obeyed to prevent fast_find_migrateblock() repeatedly selecting
a subset of pageblocks.

Link: https://lkml.kernel.org/r/20230515113344.6869-3-mgorman@techsingularity.netSigned-off-by: default avatarMel Gorman <mgorman@techsingularity.net>
Suggested-by: default avatarVlastimil Babka <vbabka@suse.cz>
Tested-by: default avatarRaghavendra K T <raghavendra.kt@amd.com>
Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
Cc: Chuyi Zhou <zhouchuyi@bytedance.com>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Maxim Levitsky <mlevitsk@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 539aa041
......@@ -2457,7 +2457,8 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)
}
/*
* If an ASYNC or SYNC_LIGHT fails to migrate a page
* within the current order-aligned block, scan the
* within the current order-aligned block and
* fast_find_migrateblock may be used then scan the
* remainder of the pageblock. This will mark the
* pageblock "skip" to avoid rescanning in the near
* future. This will isolate more pages than necessary
......@@ -2466,7 +2467,7 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)
* recently partially scanned.
*/
if (!pageblock_aligned(cc->migrate_pfn) &&
cc->direct_compaction && !cc->finish_pageblock &&
!cc->ignore_skip_hint && !cc->finish_pageblock &&
(cc->mode < MIGRATE_SYNC)) {
cc->finish_pageblock = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment