Re: [PATCH v6 0/3] mm: zswap: free cold writeback folios promptly
From: Andrew Morton
Date: Mon Sep 21 2026 - 15:49:06 EST
On Mon, 21 Sep 2026 17:13:01 +0200 Alexandre Ghiti <alex@xxxxxxxx> wrote:
> When zswap writes an entry back, it allocates an order-0 swap cache folio,
> decompresses into it, and issues the write. The folio is cold by
> construction, yet today it is left on the LRU for page reclaim to find and
> free later. That wastes a reclaim scan and keeps cold memory resident
> longer than necessary.
>
> Rather than implement this in zswap, extend the existing dropbehind
> mechanism to swap cache folios and have zswap opt into it (Yosry). A
> PG_dropbehind folio is already dropped from its cache once writeback
> completes instead of being left for reclaim; for a swap cache folio that
> "drop" is removing it from the swap cache.
Thanks, I updated mm.git's mm-unstable branch to this version.
> Changes in v6:
> - No functional change: this version only updates changelogs and collects
> tags.
Confirmed.
> - Patch 1: fix the changelog. The first paragraph describes the behaviour
> before the patch, so it must name swap_cache_alloc_folio(), not the
> __swap_cache_alloc_folio() this patch introduces, and the last paragraph
> now says the helper is renamed as well as that the LRU insertion is
> deferred (Kairui).
> - Patch 2: fix the changelog. The swap cluster lock is a spinlock taken
> with interrupts disabled and does not sleep; the folio lock is what the
> drop blocks on, and that is why the completion needs task context. Also
> spell out why it blocks instead of using folio_trylock() (Barry).
> - Collect Reviewed-by tags. Thanks to Kairui, Barry and Nhat for the
> reviews! Kairui's tag on patch 1 was given on the posting of the zswap
> writeback refault series [1], which carries the same patch.