Re: [PATCH] mm/mglru: Update MG-LRU proactive reclaim statistics only to memcg

From: Hao Jia
Date: Thu Jul 17 2025 - 23:09:46 EST




On 2025/7/18 03:47, Shakeel Butt wrote:
Hi Hao,

On Thu, Jul 17, 2025 at 04:28:45PM +0800, Hao Jia wrote:
From: Hao Jia <jiahao1@xxxxxxxxxxx>

Users can use /sys/kernel/debug/lru_gen to trigger proactive memory reclaim
of a specified memcg.


Hi Shakeel,

Are you using this interface for proactively reclaiming a specific
memcg?

I am comparing using /sys/kernel/debug/lru_gen or cgroup.reclaim to trigger memory reclaim when MG-LRU is enabled.
For user-mode agents, the two interfaces can achieve the same function.


I see run_cmd() using mem_cgroup_from_id() to get memcg from a
given id but I don't think we expose ids from mem_cgroup_ids to the
userspace. Usually we use cgroup_id which is just an inode number for
the cgroup folder. I wonder if the current users of this interface are
providing memcg id.

We can get memcg id through ` cat /sys/kernel/debug/lru_gen `.


Thanks,
Hao

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.