Re: [PATCH v2] mm/mglru: skip oom killing for order != 0 allocs in kswapd

From: Barry Song

Date: Wed Nov 25 2026 - 19:40:59 EST


On Wed, Nov 25, 2026 at 5:32 PM Bingfang Guo <bfguo@xxxxxxxxxx> wrote:
[...]
> You are right. Maybe we can start from skipping aging in reclaim path if the
> youngest gen is still too young? And maybe for this path, min_ttl can have a
> default value? Is that a good idea?
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index d891ae46baf49..7f9b14b772d14 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -5136,8 +5136,11 @@ static bool should_run_aging(struct lruvec *lruvec, unsigned long max_seq,
> return false;
>
> + /* avoid excessive aging for huge allocations */
> + if (unlikely(sc->order)) {
> + int gen = lru_gen_from_seq(max_seq);
> + unsigned long birth = READ_ONCE(lruvec->lrugen.timestamps[gen]);
> + return !time_is_before_jiffies(birth + min_ttl);
> + }

I'm not convinced that we need to couple the aging decision with
min_ttl protection.

This has been a long-standing problem: high-order allocations can
trigger excessive reclaim and still fail to obtain contiguous
memory.

I've tried to address this twice, but haven't found a satisfactory
solution yet:

https://lore.kernel.org/linux-mm/20260422021842.78495-1-baohua@xxxxxxxxxx/

Johannes shared some thoughts on this here:

https://lore.kernel.org/linux-mm/aejtfpBUu7gNV6Tk@xxxxxxxxxxx/

Do you have any traces showing how many pages kswapd scans and
reclaims while kcompactd makes little progress toward satisfying
order-9 allocations?

Basically, I think we need some form of throttling to prevent
kswapd from freeing more and more memory when there is already
plenty of free memory, yet compaction is making little progress
toward satisfying order-9 allocations.

>
> /* better to run aging even though eviction is still possible */
> return evictable_min_seq(min_seq, swappiness) + MIN_NR_GENS == max_seq;
>
> I will give this a test later and share more findings.

Thanks,
Barry