mm, compaction: finish scanning the current pageblock if requested
authorMel Gorman <mgorman@techsingularity.net>
Wed, 25 Jan 2023 13:44:33 +0000 (13:44 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 3 Feb 2023 06:33:30 +0000 (22:33 -0800)
cc->finish_pageblock is set when the current pageblock should be rescanned
but fast_find_migrateblock can select an alternative block.  Disable
fast_find_migrateblock when the current pageblock scan should be
completed.

Link: https://lkml.kernel.org/r/20230125134434.18017-4-mgorman@techsingularity.net
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
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>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/compaction.c

index a865599..91acde9 100644 (file)
@@ -1762,6 +1762,13 @@ static unsigned long fast_find_migrateblock(struct compact_control *cc)
                return pfn;
 
        /*
+        * If the pageblock should be finished then do not select a different
+        * pageblock.
+        */
+       if (cc->finish_pageblock)
+               return pfn;
+
+       /*
         * If the migrate_pfn is not at the start of a zone or the start
         * of a pageblock then assume this is a continuation of a previous
         * scan restarted due to COMPACT_CLUSTER_MAX.