Re: [PATCH v3 00/20] Virtual Swap Space
From: Chris Li
Date: Thu Feb 12 2026 - 00:07:38 EST
On Tue, Feb 10, 2026 at 11:11 AM Nhat Pham <nphamcs@xxxxxxxxx> wrote:
>
> On Tue, Feb 10, 2026 at 10:00 AM Kairui Song <ryncsn@xxxxxxxxx> wrote:
> >
> > On Mon, Feb 9, 2026 at 7:57 AM Nhat Pham <nphamcs@xxxxxxxxx> wrote:
> > >
> > > Anyway, resending this (in-reply-to patch 1 of the series):
> >
> > Hi Nhat,
> >
> > > Changelog:
> > > * RFC v2 -> v3:
> > > * Implement a cluster-based allocation algorithm for virtual swap
> > > slots, inspired by Kairui Song and Chris Li's implementation, as
> > > well as Johannes Weiner's suggestions. This eliminates the lock
> > > contention issues on the virtual swap layer.
> > > * Re-use swap table for the reverse mapping.
> > > * Remove CONFIG_VIRTUAL_SWAP.
> >
> > I really do think we better make this optional, not a replacement or
> > mandatory. There are many hard to evaluate effects as this
> > fundamentally changes the swap workflow with a lot of behavior changes
> > at once. e.g. it seems the folio will be reactivated instead of
> > splitted if the physical swap device is fragmented; slot is allocated
> > at IO and not at unmap, and maybe many others. Just like zswap is
> > optional. Some common workloads would see an obvious performance or
> > memory usage regression following this design, see below.
>
> Ideally, if we can close the performance gap and have only one
> version, then that would be the best :)
>
> Problem with making it optional, or maintaining effectively two swap
> implementations, is that it will make the patch series unreadable and
> unreviewable, and the code base unmaintanable :) You'll have x2 the
> amount of code to reason about and test, much more merge conflicts at
> rebase and cherry-pick time. And any improvement to one version takes
> extra work to graft onto the other version.
I second that this should be run time optional for other types of
swap. It should not be mandatory for other swap that does not benefit
from it. e.g. zram.
Chris