Re: [PATCH v9 16/32] mm: zswap: reject high-order swap cache allocations backed by zswap

From: Nhat Pham

Date: Fri Nov 06 2026 - 11:34:04 EST


On Thu, Nov 5, 2026 at 11:41 AM Usama Arif <usama.arif@xxxxxxxxx> wrote:
>
> zswap stores swapped-out pages one at a time, so a range of swap slots can
> be split between zswap entries and the backing device. A high-order
> swap-cache folio over such a range cannot be read back in one go: the disk
> read would return stale or zero data for every slot zswap owns.
>
> Reject that in __swap_cache_alloc(). Do the check after the folio is in the
> swap cache: from that point zswap can neither start storing nor start
> writing back any slot in the range, so the answer is stable. Callers
> already fall back to order-0, which zswap_load() handles per page.
>
> Co-developed-by: Alexandre Ghiti <alex@xxxxxxxx>
> Signed-off-by: Alexandre Ghiti <alex@xxxxxxxx>
> Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>

Reviewed-by: Nhat Pham <nphamcs@xxxxxxxxx>