Re: [RFC PATCH 1/1] mm: Reduce direct reclaim stalls with RAM-backed swap
From: Johannes Weiner
Date: Tue Mar 03 2026 - 11:59:28 EST
On Tue, Mar 03, 2026 at 06:10:07AM -0800, Christoph Hellwig wrote:
> No way. Stop adding hacks to the block layer just because you're
> abusing a block driver for compressed swap. Please everyone direct
> their enegery to pluggable zwap backends and backing store less zswap
> now instead of making the zram mess even worse.
+1
The virtual block device idea seems simple and attractive at first
because, hey it looks just like any other swap device, and the block
surface is so much smaller than the MM surface.
But compression is a *memory* consumer. A big one. And with swap it
sits in the reclaim path. So now you have to solve intricate MM
problems with the block layer in between.
The effectiveness of compression as a reclaim strategy is also highly
variable and dependent on page contents, so the static properties of
the block device abstraction are a poor fit for the problem space.
I'd propose the following:
What keeps users in the zram camp is disk-less setups.
What keeps users in the zswap camp is reclaim-writeback, cgroup
accounting & control, and the prospect of fully dynamic sizing.
There are ongoing efforts to solve zswap's disk requirement and with
it its dependency on static address spacing.
The gap on the zram side looks wider, and more awkward to solve given
the block layer intermediary. And it's already 2.6x the SLOC of zswap.
So I fully agree. We should try to make zswap the single compressed
swap implementation. It would simplify things dramatically for kernel
developers working on MM and the swap subsystem. It would make things
better for users too.