The patch titled Subject: mm: compaction: only force pageblock scan completion when skip hints are obeyed has been added to the -mm mm-unstable branch. Its filename is mm-compaction-only-force-pageblock-scan-completion-when-skip-hints-are-obeyed.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-compaction-only-force-pageblock-scan-completion-when-skip-hints-are-obeyed.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Subject: mm: compaction: only force pageblock scan completion when skip hints are obeyed Date: Mon, 15 May 2023 12:33:42 +0100 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 cfccd2e63e7e ("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@xxxxxxxxxxxxxxxxxxx Signed-off-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Suggested-by: Vlastimil Babka <vbabka@xxxxxxx> Cc: Chuyi Zhou <zhouchuyi@xxxxxxxxxxxxx> Cc: Jiri Slaby <jirislaby@xxxxxxxxxx> Cc: Maxim Levitsky <mlevitsk@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx> Cc: Pedro Falcato <pedro.falcato@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/compaction.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/mm/compaction.c~mm-compaction-only-force-pageblock-scan-completion-when-skip-hints-are-obeyed +++ a/mm/compaction.c @@ -2485,7 +2485,8 @@ rescan: } /* * 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 @@ -2494,7 +2495,7 @@ rescan: * 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; _ Patches currently in -mm which might be from mgorman@xxxxxxxxxxxxxxxxxxx are mm-compaction-ensure-rescanning-only-happens-on-partially-scanned-pageblocks.patch mm-compaction-only-force-pageblock-scan-completion-when-skip-hints-are-obeyed.patch mm-compaction-update-pageblock-skip-when-first-migration-candidate-is-not-at-the-start.patch revert-revert-mm-compaction-fix-set-skip-in-fast_find_migrateblock.patch