Re: [PATCH v5 0/3] mm: fix workingset refaults in the zswap writeback path

From: Yosry Ahmed

Date: Thu Dec 03 2026 - 11:18:35 EST


> > > > > > > >
> > > > > > > > I wonder if both problems can be tackled at once if we handle this
> > > > > > > > within the swap cache, and if the implementation would be simpler.
> > > > > > >
> > > > > > > Porting this solution to vswap kind of gives you the generic solution
> > > > > > > that you're interested in.
> > > > > > >
> > > > > > > In vswap world, we add a per-swap-cluster array for the backend. So
> > > > > > > instead of moving the shadow to the zswap tree during writeback, we
> > > > > > > will move the shadow to that array instead (and everything else in
> > > > > > > this patch series stay the same). That is plenty generic - it will
> > > > > > > work for all form of backend transfer mechanisms that rely on swap
> > > > > > > cache as the synchronization point.
> > > > > > >
> > > > > > > (I'm not sure if we'll have enough tags in 32 bit systems though -
> > > > > > > might have to add a type field for that setup).
> > > > > > >
> > > > > > > So basically, this is another reason that you kind of need vswap for
> > > > > > > efficient and sound backend transfer :)
> > > > > >
> > > > > > I agree that vswap provides a better place for this, but I honestly
> > > > > > don't like shoving the shadow into the zswap entry in the meantime.
> > > > > > Would this be cleaner / more generic if it's done within the
> > > > > > swapcache? We can always move it to vswap later as needed.
> > > > >
> > > > > What do you mean by "within the swap cache"? The swap table slot that
> > > > > used to hold the shadow now carries the swap cache folio, so we can't
> > > > > really store it there. I guess we can tinker with the folio's fields?
> > > > > Not sure if that's cleaner though...
> > > >
> > > > Hmm yeah.. I honestly wonder if we should table this (patch 3
> > > > specifically) until vswap lands. More motivation for landing vswap :P
> > > >
> > >
> > > Yes the virtual_table of vswap would be "prettier" (even though my llm
> > > and I did not find an easy way to use it during writeback @Nhat).
> > >
> > > But as Nhat said (and unless someone has a better idea), this is the
> > > only thing that would change with vswap, so it won't make it easier to
> > > review.
> > >
> > > In addition, this fix then becomes totally un-backportable to stable
> > > releases (this bug has been present since 5.9).
> >
> > I am not sure if this is stable-worthy to be honest. It's a
> > performance thing and it has been a while, so I don't think that's an
> > issue. Perhaps it doesn't look much better on top of vswap, but I
> > think maintaining the shadow when moving a page between swap backends
> > at least fits better there conceptually.
>
> Ok, I still need to go through Chris's answers, but the plan so far is
> to send patch 1 (I'll try to teach swapcache about writeback as you
> mentioned earlier)

Not sure if that would be strictly better, it was just an idea, and
the hope was mainly to get rid of patch 3 -- which I now realize is
unrelated.

> on its own and rebase patches 2 and 3 on top of
> vswap for later.

Thank you, and sorry if my response was disappointing.