Re: Virtual Swap Sync

From: Baoquan He

Date: Thu Nov 26 2026 - 01:03:31 EST


On 11/22/26 at 08:31am, Nhat Pham wrote:
> On Thu, Nov 5, 2026 at 2:06 PM Nhat Pham <nphamcs@xxxxxxxxx> wrote:
> >
> > Hi folks,
> >
>
> Hi folks - thanks everyone for attending. :)
>
> I summarized the points we discussed below - please let me know if I
> missed anything or misunderstood a point.
>
> * Control interface: Google is interested in a knob to cease zswapping
> (which already exists and will still work in vswap world). Kairui has
> a use case for remapping all swapped-out pages.
>
> Vswap currently bypassed when zswap is off; per-cgroup selection could
> be added as concrete use case arises (for e.g migration/compaction).
>
> David objected that a virtual swap abstraction should not carry a
> swapoff interface per se. Folks also asked whether making vswap a
> mandatory layer would make the implementation cleaner (Nhat will
> explore this direction and follow up on this).
>
> * Virtual space sizing: We discussed using vm.overcommit_ratio and
> vm.overcommit_memory to limit the host's logical memory footprint. The
> exact sizing formula is still unclear - Nhat will follow up with
> Kairui on whether it is acceptable.
>
> (Kairui, if possible, can you respond here for your exact use case? Do
> you want to limit physical memory usage, or virtual? My understanding
> is you want to gate physical + swap, which would be closer to the
> latter).
>
> * Priority and multiple swapfiles: should not be added for now.
> No good use case for swap priority was identified.
> Multiple swapfiles were used in the past to work around swapfile
> lock contention, but it is unclear whether they are still needed with
> Kairui's new cluster-based allocator. If contention remains a problem,
> we should fix it in the kernel before putting that burden on
> userspace.
>
> * Proposed phase split and charging (from Nhat):
>
> - Phase 1 - initial foundation:
> - Decoupled zswap: Let zswap operate without reserving disk swap
> for every virtual entry.
> - Physical backing and writeback: Keep disk swap available as a
> backend, including when zswap cannot store a page or an entry needs
> writeback.
> - Charging: Retain memsw charging for virtual entries; keep
> virtual-slot usage out of memory.swap.max. Actual physical swap usage
> keeps its resource charging.
> - Usage counter: Expose vswap usage so users can monitor
> virtual-space consumption separately from physical swap usage.
> Essentially this gives you a method to estimate the logical footprint
> (memory.current - swapcached + vswap).
>
> - Subsequent phase(s) - further support and controls:
> - VM_SPARSE: Add VM_SPARSE as an optimization after the
> first-phase foundation.
> - Runtime controls (added as use cases arise):
> - Host-wide runtime disablement knob (and remapping of swapped out data).
> - Per-cgroup vswap control (for e.g, if some cgroups want
> migrations/physical swapfile compaction).
>
> - Orthogonal use cases and concerns:
> - Cgroup-level logical memory limits in cgroupv2 (memsw?) - swap
> developers will follow up with memcg maintainers.
> - Static sizing: Define the host-sizing formula and decide whether
> another interface is needed.
> - Swap tiering for cgroups: Explore backend selection when a
> concrete workload needs it.

Youngjun's swap tier comes from concrete use case of his company, it's
been v11, he presented this in LSF and LPC.

[RFC PATCH v11 0/4] mm/swap: priority-based swap tiers with per-cgroup selection
https://lore.kernel.org/all/20260916183437.2946306-1-youngjun.park@xxxxxxx/T/#u

This is xswap road map I shared with you when we discussed about working
together. I also mentioned swap tier in road map because Swap tier is a
very important feature we swap developers plan to add.

https://lore.kernel.org/all/al8ohWshSSZ64AtT@MiWiFi-R3L-srv/

I thought you had read them.

I don't know why I couldn't join meeting last time, I tried at 8:05am at
my side, kept waiting for people to approve me until 8:30am I was
added. Not sure if you guys also talked about this.

Thanks
Baoquan

>
> Folks, please comment on the summary and proposal.
>
> Let us keep the communication line open and coordinate on the next
> steps. I will schedule something again.
>
> Also taking a step back - once we reach a consensus on vswap, maybe we
> can repurpose this series of meeting for general swap alignment? There
> are other swap/compressed swap developments right now (looking at the
> orthogonal use cases list above for e.g), so maybe we can do this once
> or twice a month. My experience in the past year or so has shown that
> we clearly need better alignment :)
>
> I will reach out to set up another round of meeting. I'm hoping we can
> do it one more time in December, but I understand that holiday season
> is coming :)
>
> For folks in the U.S, I wish you all a merry and festive Thanksgiving.