Re: Path forward for Virtualized Swap?

From: Gregory Price (Meta)

Date: Sat Oct 24 2026 - 16:49:00 EST


On 2026-10-24 14:16 -0400, Rik van Riel wrote:
> On Sat, 2026-10-24 at 23:50 +0800, Kairui Song wrote:
> > On Sat, Oct 24, 2026 at 4:03 AM Rik van Riel <riel@xxxxxxxxxxx>
> > I also hope there is a way to release swap metadata completely too.
> > e.g. for fs, you at least have umount, and can rmmod the fs itself
> > afterwards. We also have many ways to bypass the page cache. In cases
> > where a virtual layer is just a burden, we want raw physical swap,
> > and
> > the ability to swap off that too.
>
> The VM cannot operate without the swap cache, though.
>
> That is very much built into core parts of the VM.
>
> However, having swapoff remove all data from the swap
> cache, after mapping the memory back into userspace
> page tables, seems like it would be fairly easy to do.
>
> Does that meet the needs of your use case?
>

It may be good to talk about this in terms of discrete workflows and
interfaces, rather than in the abstract. Just describing effects
creates a confusing situation without including the cause.

Isn't this as simple as having something like:

echo 1 > /sys/kernel/mm/swap/drop_cache

('simple' is doing a lot of work here)

--
~Gregory