Re: [PATCH v7 0/4] mm: avoid large folio splits when swap is unavailable

From: Andrew Morton

Date: Mon Aug 31 2026 - 23:39:53 EST


On Sun, 30 Aug 2026 12:29:16 +0800 Xueyuan Chen <xueyuan.chen21@xxxxxxxxx> wrote:

> This is v7 of Barry's original RFC patch, "mm: Avoiding split large
> folios if swap has no space":
>
> https://lore.kernel.org/r/20260618221720.71768-1-baohua@xxxxxxxxxx
>
> Barry's RFC showed the no-swap case with MADV_PAGEOUT on 16KB mTHP: the
> large-folio split counter increased by 1024 even though no swapout
> progress was possible. Skipping the split in that case kept the counter
> at 0.
>
> This series makes folio_alloc_swap() classify failures according to
> whether splitting a large folio might allow swapout to make progress.
> Callers can then avoid destroying the large folio when neither global
> swap availability nor the folio's memcg swap hierarchy has capacity for
> even a smaller folio.

Thanks. Sashiko had a question which didn't occur against v6:

https://sashiko.dev/#/patchset/20260830-folio_swap_entry-v1-0-7786b52acbc8@xxxxxxxxxxxx