Re: [PATCH v5 00/21] Virtual Swap Space
From: Nhat Pham
Date: Tue Mar 24 2026 - 13:28:41 EST
On Tue, Mar 24, 2026 at 9:19 AM Askar Safin <safinaskar@xxxxxxxxx> wrote:
>
> Nhat Pham <nphamcs@xxxxxxxxx>:
> > We can even perform compressed writeback
> > (i.e writing these pages without decompressing them) (see [12]).
>
> > [12]: https://lore.kernel.org/linux-mm/ZeZSDLWwDed0CgT3@xxxxxxxxxxxxxxxxxxxx/
>
> This is supported in zram. The support was added here:
> https://lore.kernel.org/all/20251201094754.4149975-1-senozhatsky@xxxxxxxxxxxx/ .
> It is already in mainline.
I'm aware of that work. It's an improvement, but my understanding is:
1. It only works for zram.
2. We still occupy the full PAGE_SIZE slot.
3. The writeback IO request is still of size PAGE_SIZE.
So we're saving the CPU work for decompression, but not the rest of
the potential benefits of compressed writeback.
For zswap, decoupling zswap and disk swap is a pre-requisite
(otherwise every zswap slot occupy a PAGE_SIZE slot in the swapfile
anyway).
Then, we have two alternatives. Either we implement a small-slot
allocator for swapfile-infra, or we writeback a full backing page for
compressed memory. The second option is a bit more straightforward,
but then we lose relative age of these objects - a backing page might
combine very recent compressed pages and very old compressed pages.
These approaches have different performance tradeoffs and need to be
evaluated. But anyway this is future work.