Re: [PATCH 1/5] mm: compaction: push watermark into compaction_suitable() callers
From: Johannes Weiner
Date: Mon Mar 17 2025 - 14:19:36 EST
On Sat, Mar 15, 2025 at 09:28:16PM -0700, Hugh Dickins wrote:
> [PATCH] mm: compaction: push watermark into compaction_suitable() callers fix
>
> Stop oops on out-of-range highest_zoneidx: compaction_suitable() pass
> args to __compaction_suitable() in the order which it is expecting.
>
> Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
> ---
> mm/compaction.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 4a2ccb82d0b2..b5c9e8fd39f1 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -2433,7 +2433,7 @@ bool compaction_suitable(struct zone *zone, int order, unsigned long watermark,
> enum compact_result compact_result;
> bool suitable;
>
> - suitable = __compaction_suitable(zone, order, highest_zoneidx, watermark,
> + suitable = __compaction_suitable(zone, order, watermark, highest_zoneidx,
> zone_page_state(zone, NR_FREE_PAGES));
Ouch, thanks for the fix Hugh.
This obviously didn't crash for me, but I re-ran the benchmarks with
your fix in my test environment.
This affects the direct compaction path, and I indeed see a minor
uptick in direct compaction, with a larger reduction in daemon work.
Compact daemon scanned migrate 2455570.93 ( +0.00%) 1770142.33 ( -27.91%)
Compact daemon scanned free 2429309.20 ( +0.00%) 1604744.00 ( -33.94%)
Compact direct scanned migrate 40136.60 ( +0.00%) 58326.67 ( +45.32%)
Compact direct scanned free 22127.13 ( +0.00%) 52216.93 ( +135.98%)
Compact total migrate scanned 2495707.53 ( +0.00%) 1828469.00 ( -26.74%)
Compact total free scanned 2451436.33 ( +0.00%) 1656960.93 ( -32.41%)
It doesn't change the overall A/B picture between baseline and the
series, so I'm comfortable keeping the current changelog results.