freenode
Kernel & Low-Level

Virtualized swap stalls on cgroup memory.swap semantics

Meta’s vswap work would free zswap from disk slots, but changing how memory.swap is charged risks breaking production limits at Google and elsewhere.

Nhat Pham at Meta is seeking a clear decision on virtualized swap (vswap), a series that stops the kernel from holding a disk swap slot for pages whose data never reaches storage, including zswap-compressed and zero-filled pages. The design places a virtual entry in the page table and resolves backing separately, so compressed swap can run on machines with no swap disk at all.

The work has gone through roughly ten revisions since early 2025, is now opt-in via a kernel command-line switch, and sits on the swap-table infrastructure. On pure zswap setups the author reports near-zero extra metadata cost by merging tables rather than stacking them. End users have already run the patches with high compression ratios on small boards and larger hosts.

The blocker is not the virtualization path itself. It is what memory.swap.current and memory.swap.max should mean once some swap entries are no longer tied to physical slots. Today those counters charge swap entries even when the payload stays in RAM. Large deployments, including Google services moving between cgroup v1 memsw and v2, treat memory.swap as part of capacity and SLO accounting, often combining it with memory.current to approximate a single memory-plus-swap limit. Redefining the counter to skip virtual or compressed-only entries would break that contract. Others read the existing documentation as already implying storage-backed usage, with zswap limited through its own memory.zswap knobs.

Johannes Weiner put the bind plainly: operators already use memory.swap.max in two incompatible ways, so either choice disappoints one side. One proposed escape is a separate physical-swap counter so legacy memory.swap behavior stays stable while disk slots get their own limit. Parallel work such as Baoquan He’s xswap, which adds writeback from a compressed layer to a physical backend, is circulating at the same time.

Pham has asked for a concrete objection or an explicit go-ahead rather than further silent respins, with alignment talks expected around the next Linux Plumbers Conference.