From: "Michal Koutný" <mkoutny@suse.com>
To: Youngjun Park <youngjun.park@lge.com>
Cc: akpm@linux-foundation.org, chrisl@kernel.org, kasong@tencent.com,
hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev,
shakeel.butt@linux.dev, muchun.song@linux.dev,
shikemeng@huaweicloud.com, nphamcs@gmail.com, bhe@redhat.com,
baohua@kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, gunho.lee@lge.com,
taejoon.song@lge.com
Subject: Re: [RFC PATCH v3 3/5] mm: memcontrol: add interface for swap tier selection
Date: Tue, 3 Feb 2026 11:54:41 +0100 [thread overview]
Message-ID: <ixlef27mi6vm5pek775kyddai7rkzls6mjo434rvwwp5gulcp5@n3uzy35ta7me> (raw)
In-Reply-To: <20260131125454.3187546-4-youngjun.park@lge.com>
[-- Attachment #1: Type: text/plain, Size: 3563 bytes --]
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 <youngjun.park@lge.com> 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 <youngjun.park@lge.com>
> ---
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]
next prev parent reply other threads:[~2026-02-03 10:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-31 12:54 [RFC PATCH v3 0/5] mm/swap, memcg: Introduce swap tiers for cgroup based swap control Youngjun Park
2026-01-31 12:54 ` [RFC PATCH v3 1/5] mm: swap: introduce swap tier infrastructure Youngjun Park
2026-01-31 12:54 ` [RFC PATCH v3 2/5] mm: swap: associate swap devices with tiers Youngjun Park
2026-01-31 12:54 ` [RFC PATCH v3 3/5] mm: memcontrol: add interface for swap tier selection Youngjun Park
2026-02-03 10:54 ` Michal Koutný [this message]
2026-02-04 1:11 ` YoungJun Park
2026-01-31 12:54 ` [RFC PATCH v3 4/5] mm, swap: change back to use each swap device's percpu cluster Youngjun Park
2026-01-31 12:54 ` [RFC PATCH v3 5/5] mm, swap: introduce percpu swap device cache to avoid fragmentation Youngjun Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ixlef27mi6vm5pek775kyddai7rkzls6mjo434rvwwp5gulcp5@n3uzy35ta7me \
--to=mkoutny@suse.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=bhe@redhat.com \
--cc=cgroups@vger.kernel.org \
--cc=chrisl@kernel.org \
--cc=gunho.lee@lge.com \
--cc=hannes@cmpxchg.org \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=nphamcs@gmail.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=shikemeng@huaweicloud.com \
--cc=taejoon.song@lge.com \
--cc=youngjun.park@lge.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox