Re: [PATCH v4 1/3] mm: swap: move LRU insertion out of the swap cache allocator

From: Nhat Pham

Date: Tue Sep 08 2026 - 14:28:02 EST


On Tue, Aug 25, 2026 at 6:53 AM Alexandre Ghiti <alex@xxxxxxxx> wrote:
>
> zswap writeback wants a swap cache folio it can free directly once
> writeback completes, i.e. one that is not on the LRU (folio_add_lru()
> stages the folio in a per-CPU batch that holds a reference until it is
> drained, which keeps remove_mapping() from freeing the folio on
> synchronous devices, and likely on asynchronous ones too).
>
> So defer the LRU addition to the callers of __swap_cache_alloc_folio(),
> no functional change intended.
>
> Suggested-by: Kairui Song <kasong@xxxxxxxxxxx>
> Signed-off-by: Alexandre Ghiti <alex@xxxxxxxx>

LGTM.

Reviewed-by: Nhat Pham <nphamcs@xxxxxxxxx>