Re: [PATCH v7 00/20] mm: mandatory virtual swap
From: Nhat Pham
Date: Thu Dec 03 2026 - 18:14:28 EST
On Thu, Dec 3, 2026 at 4:05 PM Yosry Ahmed <yosry@xxxxxxxxxx> wrote:
>
> > > > II. Design
> > > > ==========
> > > >
> > > > Patches 1-15 build the optional vswap implementation, roughly equivalent
> > > > to v6 in functionality. Patches 16-20 then make it the common layer for
> > > > ordinary swapping.
> > >
> > > I assume that if we decide to go this route we will fold these patches
> > > into the series (i.e. start with always-on vswap to begin with)?
> >
> >
> > Let me try that one first. If it's easier to review then I certainly
> > can give it a shot.
>
> I would expect/hope so. Thanks!
>
> > > > III. Mandatory vswap
> > > > ====================
> > > >
> > > > In the v6 version, vswap keeps separate virtual and direct physical swap
> > > > paths.
> > > >
> > > > At the last vswap sync, we discussed making vswap mandatory to simplify
> > > > the implementation. Patches 16-20 apply this conversion after the
> > > > optional vswap implementation.
> > > > Anonymous and shmem swapping use virtual entries throughout, with swap
> > > > counts, swapcache and cgroup ownership held at the virtual slot.
> > > >
> > > > Physical swap supplies disk backing and raw hibernation slots. Its swap
> > > > table records reverse mappings to virtual slots, so backing reclaim can
> > > > find the owner directly. Compressed zswap entries live in the vtable,
> > > > removing per-device zswap trees. Initialize vswap automatically when
> > > > CONFIG_SWAP is enabled, and move virtual-only fields out of physical
> > > > clusters.
> > >
> > > This section should call out the extra memory overhead when zswap is
> > > not used. More generally, I think the cover letter should call out the
> > > memory overhead for zswap and non-zswap cases (I believe the former is
> > > 0?).
> >
> > Yeah the former is 0.
> >
> > For non-zswap backend, it's 16 bytes per entry! For the forward and
> > reverse map. We can get rid of the reverse map, if we can get rid of
> > cluster readahead, and implement a different scheme to do
> > swap-cache-only freeing. We can do it as a follow-up.
>
> This is per used swapped out entry, not for the entire swapfile size, right?
Yup. Per-used entry only. The reverse map uses swap table
infrastructure, which is dynamically allocated (i.e on demand).