Re: [PATCH] mm: Require LRU reclaim progress before retrying direct reclaim
From: Shakeel Butt
Date: Thu Apr 16 2026 - 17:50:07 EST
On Thu, Apr 16, 2026 at 03:51:04PM +0100, Matt Fleming wrote:
> On Wed, Apr 15, 2026 at 03:57:25PM +0100, Pedro Falcato wrote:
[...]
>
> > My theory (from merely reading the patch, maybe I missed something) is that
> > a pathological case for this is a lot of folios added to the LRU in a row,
> > that are set referenced (or dirty). Say SWAP_CLUSTER_MAX * MAX_RECLAIM_RETRIES
> > - it will simply OOM too early.
>
> OK yeah I think I see the problem now: this heuristic applies the
> threshold against all reclaimable pages but that falls apart when doing
> SWAP_CLUSTER_MAX chunks of reclaim.
I am not sure I understand the pathological case. Yes SWAP_CLUSTER_MAX is
requested amount of pages to reclaim but the kernel can potentially scan full
memory twice to reclaim that much amount. Though those reclaimed pages can get
stolen but that can still happen today before this patch.