Re: [RFC PATCH v11 0/4] mm/swap: priority-based swap tiers with per-cgroup selection
From: Johannes Weiner
Date: Wed Sep 16 2026 - 16:05:44 EST
On Thu, Sep 17, 2026 at 03:34:33AM +0900, Youngjun Park wrote:
> Per-cgroup swap in debugfs
> ==========================
>
> Patches 3 and 4 let a memory cgroup choose its tiers through debugfs.
>
> # swapon -p 100 /dev/nvme0n1p2
> # swapon -p 50 /dev/sdb2
> # cat /sys/kernel/debug/swap/tiers
> Idx Prio
> 0 100
> 1 50
> # echo "/batch 0x2" > /sys/kernel/debug/swap/memcg_tiers
>
> Bit i of the mask is tier i, so /batch swaps only to sdb2. A tier keeps
> its index for its lifetime, so the mask keeps selecting the same tier
> across swapon and swapoff.
Can the cgroup be given a priority limit? That would have pretty
obvious inheritance semantics:
root
`- batch (memory.swap.prio.max = 20)
`- task (memory.swap.prio.max = max)
`- logs (memory.swap.prio.max = 10)
`- interactive (memory.swap.prio.max = max)
`- task (memory.swap.prio.max)