Re: [RFC PATCH v2 0/5] mm/swap, memcg: Introduce swap tiers for cgroup based swap control

YoungJun Park
2026-02-13T02:43:49Z

On Thu, Feb 12, 2026 at 09:57:40AM -0800, Nhat Pham wrote:
> On Sun, Jan 25, 2026 at 10:53 PM Youngjun Park <youngjun.park@lge.com> wrote:
> >
> > This is the second version of the RFC for the "Swap Tiers" concept.
> > Link to v1: https://lore.kernel.org/linux-mm/20251109124947.1101520-1-youngjun.park@lge.com/
> >
> > This version incorporates feedback received during LPC 2025 and addresses
> > comments from the previous review. We have also included experimental
> > results based on usage scenarios intended for our internal platforms.
> >
> > Motivation & Concept recap
> > ==========================
> > Current Linux swap allocation is global, limiting the ability to assign
> > faster devices to specific cgroups. Our initial attempt at per-cgroup
> > priorities proved over-engineered and caused LRU inversion.
> >
> > Following Chris Li's suggestion, we pivoted to "Swap Tiers." A tier is
> > simply a user-named group of swap devices sharing the same priority range.
> > This abstraction facilitates swap device selection based on speed, allowing
> > users to configure specific tiers for cgroups.
> >
> > For more details, please refer to the LPC 2025 presentation
> > https://lpc.events/event/19/contributions/2141/attachments/1857/3998/LPC2025Finalss.pdf
> > or v1 patch.
> >
> > Changes in v2
> > =============
> > 1. Respect cgroup hierarchy principle (LPC 2025 feedback)
> > - The logic now strictly follows standard cgroup hierarchy principles.
> >
> > Previous: Children could select any tier using "+" regardless of the
> > parent's configuration. "+" tier is referenced. (could not be silently disappeared)
> >
> > Current: The explicit selection ("+") concept is removed. By
> > default, all tiers are selected. Users now use "-" to exclude specific
> > tiers. Excluded tier could disappeared silently.
> > A child cgroup is always a subset of its parent. Even if a child
> > re-enables a tier with "+" that was excluded by the parent, the effective
> > tier list is limited to the parent's allowed subset.
>
> This comment seems a bit clunky to me. The "+" is removed, as noted
> above, but then why are we saying "even if a child re-enables a tier
> with "+"" here? Am I missing something?

To clarify, previously, the default state used all tiers. Using "+"
switched to "an exclusive mode" where only that specific tier was used.

I am changing this to a subtraction-based model. By default, all tiers
are selected, and users use "-" to exclude specific ones.
(Then not "removed" but "changed" is more proper?)

In this context, I intended "+" to be used to restore a tier that was
previously excluded by "-".

> >
> > Example:
> > Global Tiers: SSD, HDD, NET
> > Parent: SSD, NET (HDD excluded)
> > Child: HDD, NET (SSD excluded)
> > -> Effective Child Tier: NET (Intersection of Parent and Child)
>
> But otherwise, I assume you mean to restrict child's allowed swap
> tiers to be a subset of children and its ancestors?

Exactly.

> That seems more
> straightforward to me than the last system :)

Yes, that's right :)

Thanks
Youngjun Park.