From: Jiayuan Chen <jiayuan.chen@linux.dev>
To: linux-mm@kvack.org
Cc: "Jiayuan Chen" <jiayuan.chen@linux.dev>,
"Tejun Heo" <tj@kernel.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutný" <mkoutny@suse.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Axel Rasmussen" <axelrasmussen@google.com>,
"Yuanchu Xie" <yuanchu@google.com>, "Wei Xu" <weixugc@google.com>,
"David Hildenbrand" <david@kernel.org>,
"Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
"Vlastimil Babka" <vbabka@suse.cz>,
"Mike Rapoport" <rppt@kernel.org>,
"Suren Baghdasaryan" <surenb@google.com>,
"Michal Hocko" <mhocko@suse.com>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Shakeel Butt" <shakeel.butt@linux.dev>,
"Muchun Song" <muchun.song@linux.dev>,
"Qi Zheng" <zhengqi.arch@bytedance.com>,
cgroups@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 0/3] mm/lru_gen: add memory.lru_gen interface for cgroup v2
Date: Wed, 21 Jan 2026 20:39:46 +0800 [thread overview]
Message-ID: <20260121123955.84806-1-jiayuan.chen@linux.dev> (raw)
This patchset adds a memory.lru_gen interface to cgroup v2, allowing users
to interact with MGLRU directly on a specific cgroup without needing to
know the internal memcg_id.
Motivation
==========
Currently, the only way to perform aging or eviction on a specific memcg
is through the debugfs interface (/sys/kernel/debug/lru_gen), which
requires the memcg_id. However, there's no straightforward way to get the
memcg_id for a given cgroup path. This makes it difficult for users to
leverage MGLRU's proactive reclaim capabilities on specific cgroups.
Solution
========
The new memory.lru_gen interface operates directly on the cgroup:
# Show lru_gen info for this cgroup
cat /sys/fs/cgroup/mygroup/memory.lru_gen
# Run aging on node 0
echo '+ 0 <seq>' > /sys/fs/cgroup/mygroup/memory.lru_gen
# Evict cold pages on node 0
echo '- 0 <seq> <swappiness> <nr_to_reclaim>' > \
/sys/fs/cgroup/mygroup/memory.lru_gen
This interface is available on all cgroups including root, providing the
same functionality as the debugfs lru_gen interface.
Testing
=======
Create 1GB page cache, loop access 200MB as hot pages.
After aging twice, 200MB hot pages are in young generation,
800MB cold pages remain in oldest generation.
Eviction with seq=min_seq only reclaims cold pages, hot pages preserved.
Patches
=======
Patch 1 refactors the existing debugfs code to extract helper functions.
Patch 2 adds the memory.lru_gen interface using these helpers.
Patch 3 adds documentation for the new interface.
Jiayuan Chen (3):
mm/lru_gen: refactor to extract helper functions
mm/lru_gen: add memory.lru_gen interface for cgroup v2
docs/cgroup: document memory.lru_gen interface
Documentation/admin-guide/cgroup-v2.rst | 17 +++
include/linux/mmzone.h | 16 +++
mm/memcontrol.c | 31 +++++
mm/vmscan.c | 176 +++++++++++++++++++-----
4 files changed, 206 insertions(+), 34 deletions(-)
--
2.43.0
next reply other threads:[~2026-01-21 12:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 12:39 Jiayuan Chen [this message]
2026-01-21 12:39 ` [RFC PATCH 1/3] mm/lru_gen: refactor to extract helper functions Jiayuan Chen
2026-01-21 12:39 ` [RFC PATCH 2/3] mm/lru_gen: add memory.lru_gen interface for cgroup v2 Jiayuan Chen
2026-01-21 12:39 ` [RFC PATCH 3/3] docs/cgroup: document memory.lru_gen interface Jiayuan Chen
2026-01-21 22:19 ` [RFC PATCH 0/3] mm/lru_gen: add memory.lru_gen interface for cgroup v2 Shakeel Butt
2026-01-22 1:30 ` Jiayuan Chen
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=20260121123955.84806-1-jiayuan.chen@linux.dev \
--to=jiayuan.chen@linux.dev \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=cgroups@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=mkoutny@suse.com \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=tj@kernel.org \
--cc=vbabka@suse.cz \
--cc=weixugc@google.com \
--cc=yuanchu@google.com \
--cc=zhengqi.arch@bytedance.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