Commit a8d13355 authored by Baolin Wang's avatar Baolin Wang Committed by Andrew Morton
Browse files

mm: compaction: skip fast freepages isolation if enough freepages are isolated

I've observed that fast isolation often isolates more pages than
cc->migratepages, and the excess freepages will be released back to the
buddy system.  So skip fast freepages isolation if enough freepages are
isolated to save some CPU cycles.

Link: https://lkml.kernel.org/r/f39c2c07f2dba2732fd9c0843572e5bef96f7f67.1685018752.git.baolin.wang@linux.alibaba.com


Signed-off-by: default avatarBaolin Wang <baolin.wang@linux.alibaba.com>
Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 447ba886
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1528,6 +1528,10 @@ static void fast_isolate_freepages(struct compact_control *cc)

		spin_unlock_irqrestore(&cc->zone->lock, flags);

		/* Skip fast search if enough freepages isolated */
		if (cc->nr_freepages >= cc->nr_migratepages)
			break;

		/*
		 * Smaller scan on next order so the total scan is related
		 * to freelist_scan_limit.