Re: Path forward for Virtualized Swap?

From: Shakeel Butt

Date: Thu Sep 10 2026 - 13:20:51 EST


On Thu, Sep 10, 2026 at 03:09:59PM +0800, Baoquan He wrote:
> Hi Nhat,
>
> On 09/04/26 at 02:14pm, Nhat Pham wrote:
> .....snip...

[...]

> With VM_SPARSE, xswap's cluster access is exactly the plain-array line the
> rest of swap already uses:
>
> return &si->cluster_info[offset / SWAPFILE_CLUSTER];
>
> no branch, no RCU discipline, no tear-down state machine, and no NULL
> return. So VM_SPARSE doesn't add complexity to close a gap; it lets the
> cluster layer stay as simple as it already is, which is precisely the
> part later work (writeback, rmap lookup, memcg charging, THP) has to sit
> on.
>
> I'm not going to claim xswap wins on throughput. I measured it:
> on a 64G/64-thread swapout, xswap, vswap and plain swap+zswap are all
> within ~2-3% of each other, effectively identical.

So the claim is VM_SPARSE is simpler than xarray based approach. I feel like
we are discussing implementation details before deciding the design and
architecture. So, instead of VM_SPARSE vs xarray, let's discuss and decide the
need for dynamic growth. Why we want dynamic growth upfront or can it be added
later? Once we decide that then it will be very easy to pick an implementation
that would take us there.