Re: [PATCH v10 0/6] mm/swap, memcg: Introduce swap tiers for cgroup based swap control
From: Yosry Ahmed
Date: Tue Jul 14 2026 - 16:52:36 EST
> > > >
> > > > Hello Yosry!
> > > >
> > > > This series does not cover zswap as a tier yet.
> > > >
> > > > My plan is to land the swap tier infrastructure together with the
> > > > first use case (cgroup-based swap control) first, and then follow
> > > > up with zswap tier support in a subsequent series, continuing the
> > > > discussions we've had above.
> > > > (I mentioned on cover letter, right above the overview section)
> > > >
> > > > Does that approach sound reasonable to you?
> > >
> > > How does swap tiering work with zswap in the current series? I assume
> > > zswap is just enabled for all devices in all tiers?
> >
> > Yes, that's correct.
> >
> > > I wonder if introducing zswap as a tier after the fact changes user-visible
> > > behavior. I guess if zswap will be introduced with a default "max"
> > > value it will more-or-less be the same behavior,
> >
> > Right, that's the plan.
> >
> > > but I would check all
> > > user-visible behaviors related to zswap (e.g. interaction with other
> > > zswap interfaces) to make sure nothing breaks or changes in a
> > > meaningful way when zswap is introduced as a tier later.
> >
> > Fair point. Let me review this more and get back to you!
>
> Please do report back what you find.
>
> Yosry, what is needed to enable zswap as a swap tier? What will be the minimum
> requirements for that?
>From zswap's perspective, we just need to skip zswap is zswap as a
tier is disallowed. Could just be a check in zswap_store() similar to
the check if zswap is enabled. I am assuming that if a swap tier is
disabled, nothing happens to the existing swapped out pages in this
tier, but new pages do not get swapped out to it. This is the same
behavior that happens if zswap is disabled at runtime.
>From the tiering perspective, we need to accept "zswap" as a possible
tier, or maybe creating it as a tier by default if zswap is configured
would be better to avoid handling the case where the user doesn't
create a tier for zswap. We also need to disallow zswap being the only
tier as that combination cannot work without vswap.
I think this should be enough to support "zswap" as a tier and allow
disabling/enabling zswap per-memcg (or globally?) through tiering.
In the future, if/when swap demotion is added, we need to figure out
how that would work with zswap. For example, if pages should go to
swap device A then swap device B, then an entry in zswap using a swap
slot in device B should not skip device A and be written back directly
to B. vswap would naturally give us a solution for this problem.
> If that is not too much, we can make that part of this series.
Yeah I think it's better if we agree on the design and zswap support
before landing partial support.