[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250717082845.34673-1-jiahao.kernel@gmail.com>
Date: Thu, 17 Jul 2025 16:28:45 +0800
From: Hao Jia <jiahao.kernel@...il.com>
To: akpm@...ux-foundation.org,
yuzhao@...gle.com,
yuanchu@...gle.com,
shakeel.butt@...ux.dev,
mhocko@...nel.org,
lorenzo.stoakes@...cle.com,
kinseyho@...gle.com,
hannes@...xchg.org,
gthelen@...gle.com,
david@...hat.com,
axelrasmussen@...gle.com,
zhengqi.arch@...edance.com
Cc: linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Hao Jia <jiahao1@...iang.com>
Subject: [PATCH] mm/mglru: Update MG-LRU proactive reclaim statistics only to memcg
From: Hao Jia <jiahao1@...iang.com>
Users can use /sys/kernel/debug/lru_gen to trigger proactive memory reclaim
of a specified memcg. Currently, statistics such as pgrefill, pgscan and
pgsteal will be updated to the /proc/vmstat system memory statistics.
This will confuse some system memory pressure monitoring tools, making
it difficult to determine whether pgscan and pgsteal are caused by
system-level pressure or by proactive memory reclaim of some specific
memory cgroup.
Therefore, make this interface behave similarly to memory.reclaim.
Update proactive memory reclaim statistics only to its memory cgroup.
Signed-off-by: Hao Jia <jiahao1@...iang.com>
---
mm/vmscan.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f8dfd2864bbf..bc92ec338065 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -5545,6 +5545,7 @@ static int run_cmd(char cmd, int memcg_id, int nid, unsigned long seq,
if (memcg_id != mem_cgroup_id(memcg))
goto done;
+ sc->target_mem_cgroup = memcg;
lruvec = get_lruvec(memcg, nid);
if (swappiness < MIN_SWAPPINESS)
@@ -5581,6 +5582,7 @@ static ssize_t lru_gen_seq_write(struct file *file, const char __user *src,
.may_swap = true,
.reclaim_idx = MAX_NR_ZONES - 1,
.gfp_mask = GFP_KERNEL,
+ .proactive = true,
};
buf = kvmalloc(len + 1, GFP_KERNEL);
--
2.34.1
Powered by blists - more mailing lists