Hi. This is merely the API feedback. (Feedback to the propsed form, I'm not sure whether/how this should interact with memory.swap.max (formally cf io.weight).) On Sat, Jan 31, 2026 at 09:54:52PM +0900, Youngjun Park wrote: > This patch integrates the swap tier infrastructure with cgroup, > enabling the selection of specific swap devices per cgroup by > configuring allowed swap tiers. > > The new `memory.swap.tiers` interface controls allowed swap tiers via a mask. > By default, the mask is set to include all tiers, allowing specific tiers to > be excluded or restored. Note that effective tiers are calculated separately > using a dedicated mask to respect the cgroup hierarchy. Consequently, > configured tiers may differ from effective ones, as they must be a subset > of the parent's. > > Note that cgroups do not pin swap tiers. This is similar to the > `cpuset` controller, which does not prevent CPU hotplug. This > approach ensures flexibility by allowing tier configuration changes > regardless of cgroup usage. > > Signed-off-by: Youngjun Park > --- > Documentation/admin-guide/cgroup-v2.rst | 27 ++++++++ > include/linux/memcontrol.h | 3 +- > mm/memcontrol.c | 85 +++++++++++++++++++++++ > mm/swap_state.c | 6 +- > mm/swap_tier.c | 89 ++++++++++++++++++++++++- > mm/swap_tier.h | 39 ++++++++++- > mm/swapfile.c | 4 ++ > 7 files changed, 246 insertions(+), 7 deletions(-) > > diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst > index 7f5b59d95fce..776a908ce1b9 100644 > --- a/Documentation/admin-guide/cgroup-v2.rst > +++ b/Documentation/admin-guide/cgroup-v2.rst > @@ -1848,6 +1848,33 @@ The following nested keys are defined. > Swap usage hard limit. If a cgroup's swap usage reaches this > limit, anonymous memory of the cgroup will not be swapped out. > > + memory.swap.tiers > + A read-write nested-keyed file which exists on non-root "nested-keyed" format is something else in this document's lingo, see e.g. io.stat. I think you wanted to make this resemble cgroup.subtree_control (which is fine). > + cgroups. The default is to enable all tiers. > + > + This interface allows selecting which swap tiers a cgroup can > + use for swapping out memory. > + > + The effective tiers are inherited from the parent. Only tiers > + effective in the parent can be effective in the child. However, > + the child can explicitly disable tiers allowed by the parent. > + > + When read, the file shows two lines: > + - The first line shows the operation string that was > + written to this file. > + - The second line shows the effective operation after > + merging with parent settings. The convention (in cpuset) is to split it in two files like memory.swap.tiers and memory.swap.tiers.effective. > + > + When writing, the format is: > + (+/-)(TIER_NAME) (+/-)(TIER_NAME) ... > + > + Valid tier names are those configured in > + /sys/kernel/mm/swap/tiers. > + > + Each tier can be prefixed with: > + + Enable this tier > + - Disable this tier > + I believe these are only superficial adjustments not affecting the implementation. Thanks, Michal