linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] mm/lru_gen: move lru_gen control interface from debugfs to procfs
@ 2025-11-28  2:53 Zicheng Wang
  2025-11-28  2:53 ` [PATCH 1/3] mm/lru_gen: add procfs support for lru_gen interfaces Zicheng Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Zicheng Wang @ 2025-11-28  2:53 UTC (permalink / raw)
  To: akpm, hannes, david, axelrasmussen, yuanchu
  Cc: mhocko, zhengqi.arch, shakeel.butt, lorenzo.stoakes, weixugc,
	Liam.Howlett, vbabka, rppt, surenb, mhocko, corbet, linux-mm,
	linux-doc, linux-kernel, Zicheng Wang

This patchset moves the lru_gen control interface from debugfs to procfs.
Exposing the interface enables the capabilities for *commercial products*
such as Android to proactive aging and reclaim.

Two main reasons:
1. The MGLRU reaches the stage where its control interface can be
consideres product-ready, not just for experiments or debugging.
In specific scenarios, proactive aging with reclaim can improve
overall system performance.
2. Commercial products like Android prohibit mounting debugfs for
security reasons (selinux neverallow). Without moving the interface
to procfs, Android cannot utilize lru_gen.

Case study:
A widely observed issue on Android is that after application launch,
the oldest anon generation often becomes empty, and file pages
are over-reclaimed.

In Android, each application owns its own memcg. When an app is swiped
away seconds or minutes after (cold) launch, it will be frozen and
part of its memory is proactively reclaimed.
At this time, both file pages and anonymous pages are temporarily unused,
while the system load is also typically low, making it an ideal time to
prefer reclaiming anon pages while retaining file cache.

Keeping more file cache benefits the system in multiple ways:
1. The device can retain a larger page cache, reducing IO.
2. When memory is tight, evicting clean cache pages is fast.
2. Super-apps such as camera benefit from reducing the chance of
slow direct reclaim on the critical startup path.

Experiments:

- after cold launch
```
Kernel version v6.6
memcg    54 /apps/some_app
node     0
1     119804          0       85461
2     119804          0           5
3     119804     181719       18667
4       1752        392         244

Kernel version v6.12
memcg    84 /apps/some_app
node     0
1      38428          0       16424
2      38428      24307       14997
3      38428     126529       56452
4      37980         27           1
```

- proactive aging 2/3 times
```
Kernel version v6.6
memcg    54 /apps/some_app
 node     0
          3     172432     102532      103441
          4      54380      74803         854
          5      28892       6496         229
          6       1588         26           0  

Kernel version v6.12
memcg    84 /apps/some_app
 node     0
          3     819624      98726      166045
          4     819176      14849        1543
          5      40000      41328        7633
          6        960          0           0     
```

In continuous app-launch scenarios (e.g., After boot, retail demo
loops, tech review testing), our measurements show: v6.6
1. Available memory improves by 400–800 MB.
2. Direct reclaim frequency and latency drop by more than 24%.
3. memavailable/cached levels aligns with traditional LRU.

Summary of average available memory (MB):
mglru without proactive aging: 6060
mglru with proactive aging test1~3: 6988/6432/6837
traditional LRU: 6982

Camera direct reclaim (10-run average):
mglru without aging: 1050 events / 460 ms
mglru with aging: 789 events / 316 ms
(25% fewer events, 31% lower latency)


Signed-off-by: Zicheng Wang <wangzicheng@honor.com>

 Documentation/admin-guide/mm/multigen_lru.rst | 19 ++++++++++
 mm/Kconfig                                    | 10 +++++
 mm/vmscan.c                                   | 37 ++++++++++++++++++-
 3 files changed, 64 insertions(+), 2 deletions(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2025-12-02  2:53 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-28  2:53 [PATCH 0/3] mm/lru_gen: move lru_gen control interface from debugfs to procfs Zicheng Wang
2025-11-28  2:53 ` [PATCH 1/3] mm/lru_gen: add procfs support for lru_gen interfaces Zicheng Wang
2025-11-28  2:53 ` [PATCH 2/3] mm/lru_gen: add configuration option to select debugfs/procfs for lru_gen Zicheng Wang
2025-11-28  4:33   ` Randy Dunlap
2025-11-28  7:19     ` wangzicheng
2025-12-01 21:35   ` Yuanchu Xie
2025-12-02  2:53     ` wangzicheng
2025-11-28  2:53 ` [PATCH 3/3] mm/lru_gen: document procfs interface " Zicheng Wang
2025-11-28 15:16 ` [PATCH 0/3] mm/lru_gen: move lru_gen control interface from debugfs to procfs Matthew Wilcox
2025-11-28 16:13   ` Liam R. Howlett
2025-12-01  4:13     ` Barry Song
2025-12-01  6:50       ` wangzicheng
2025-12-01  7:02         ` wangzicheng
2025-12-01  7:45         ` Barry Song
2025-12-01  8:14           ` wangzicheng
2025-12-01  8:48             ` Barry Song
2025-12-01  9:54               ` wangzicheng
2025-12-01 10:39                 ` Barry Song
2025-12-01 13:32                   ` wangzicheng
2025-12-01 16:57                     ` Barry Song
2025-12-02  2:28                       ` wangzicheng
2025-12-01  9:00           ` Kairui Song
2025-12-01 12:01             ` zhongjinji
2025-12-01  7:13       ` zhongjinji

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox