Re: Path forward for Virtualized Swap?
From: Chris Li
Date: Sun Sep 27 2026 - 02:23:46 EST
On Sat, Sep 26, 2026 at 2:59 PM Rik van Riel <riel@xxxxxxxxxxx> wrote:
>
> On Sat, 2026-09-26 at 11:27 -1000, Chris Li wrote:
> > On Fri, Sep 25, 2026 at 5:41 AM Johannes Weiner <hannes@xxxxxxxxxxx>
> > wrote:
> >
> > >
> > > (2) The use case we have. Use memory.swap.max to divide a finite
> > > space
> > > in storage. We only have so much space on disk, and we need to
> > > manage
> > > fair access. Note that this isn't about speed. We have a mix of
> > > containers where some use writeback and others do not. The ones who
> > > write back to the swapfile need to be able to get their fair share
> > > -
> > > not more, not less. Including something that doesn't actually
> > > consume
> >
> > Just want to make sure I understand correctly. Do you mean the fair
> > share of compressed memory used in the zswap case?
> >
> Compressed zswap memory is already accounted for
> under cgroup.memory.max.
Ack.
>
> Compressed zswap memory sits under memory.max
> together with anonymous, file, and slab cache
> memory.
I understand that.
> We do not need or want another limit there,
> though I understand other people do.
Ack.
> The fair resource use from memory.swap.max
> is to control how much of the fixed swap file
> (or swap partition) space each cgroup gets.
That is the part I am not sure I understand correctly. Fair in what
sense? Using the swap file proportional to the memory limit of the
cgroup? Do you have an example of perfectly fair swap file usage for a
cgroup with an 8G memory limit versus one with a 1G limit?
Sorry I am a bit slow grasping what exactly the fair behavior is.
Chris