The patch titled Subject: mm: compaction: skip more fully scanned pageblock has been added to the -mm mm-unstable branch. Its filename is mm-compaction-skip-more-fully-scanned-pageblock.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-compaction-skip-more-fully-scanned-pageblock.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: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx> Subject: mm: compaction: skip more fully scanned pageblock Date: Thu, 25 May 2023 20:53:58 +0800 In fast_isolate_around(), it assumes the pageblock is fully scanned if cc->nr_freepages < cc->nr_migratepages after trying to isolate some free pages, and will set skip flag to avoid scanning in future. However this can miss setting the skip flag for a fully scanned pageblock (returned 'start_pfn' is equal to 'end_pfn') in the case where cc->nr_freepages is larger than cc->nr_migratepages. So using the returned 'start_pfn' from isolate_freepages_block() and 'end_pfn' to decide if a pageblock is fully scanned makes more sense. It can also cover the case where cc->nr_freepages < cc->nr_migratepages, which means the 'start_pfn' is usually equal to 'end_pfn' except some uncommon fatal error occurs after non-strict mode isolation. Link: https://lkml.kernel.org/r/f4efd2fa08735794a6d809da3249b6715ba6ad38.1685018752.git.baolin.wang@xxxxxxxxxxxxxxxxx Signed-off-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/compaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/compaction.c~mm-compaction-skip-more-fully-scanned-pageblock +++ a/mm/compaction.c @@ -1419,7 +1419,7 @@ fast_isolate_around(struct compact_contr isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false); /* Skip this pageblock in the future as it's full or nearly full */ - if (cc->nr_freepages < cc->nr_migratepages) + if (start_pfn == end_pfn) set_pageblock_skip(page); return; _ Patches currently in -mm which might be from baolin.wang@xxxxxxxxxxxxxxxxx are mm-page_alloc-drop-the-unnecessary-pfn_valid-for-start-pfn.patch mm-compaction-drop-the-redundant-page-validation-in-update_pageblock_skip.patch mm-compaction-change-fast_isolate_freepages-to-void-type.patch mm-compaction-skip-more-fully-scanned-pageblock.patch mm-compaction-only-set-skip-flag-if-cc-no_set_skip_hint-is-false.patch mm-compaction-add-trace-event-for-fast-freepages-isolation.patch mm-compaction-skip-fast-freepages-isolation-if-enough-freepages-are-isolated.patch