Re: [RFC PATCH v2 v2 1/5] mm: swap: introduce swap tier infrastructure

YoungJun Park
2026-02-13T14:33:43Z

On Thu, Feb 12, 2026 at 01:07:45AM -0800, Chris Li wrote:
> > +}
> > +
> > +int swap_tiers_add(const char *name, int prio)
>
> When we add, modify, remove a tier. The simple case is there is no
> swap file under any tiers.
> But if the modification causes some swap files to jump to different
> tiers. That might be problematic.

I missed one comment.

The tier of existing swapfiles is immutable once assigned at swapon.
I removed tier reference.
Instead of reference counting, each operation validates the tier
range at operation time to guarantee this invariant.

- add: Does not change existing swapfiles' tier. New tier may
split priority range, but existing assignments stay.
- remove: Rejected with -EBUSY if any swapfile is attached.
- modify: Rejected if the change would cause any swapfile to
move to a different tier.

So swapfiles never jump between tiers at runtime.

Youngjun Park