Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/mglru: update MG-LRU proactive reclaim statistics only to memcg

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.

Link: https://lkml.kernel.org/r/20250717082845.34673-1-jiahao.kernel@gmail.com
Signed-off-by: Hao Jia <jiahao1@lixiang.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kinsey Ho <kinseyho@google.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Yuanchu Xie <yuanchu@google.com>
Cc: Yu Zhao <yuzhao@google.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Hao Jia and committed by
Andrew Morton
915a4022 e5eb3246

+2
+2
mm/vmscan.c
··· 5561 5561 if (memcg_id != mem_cgroup_id(memcg)) 5562 5562 goto done; 5563 5563 5564 + sc->target_mem_cgroup = memcg; 5564 5565 lruvec = get_lruvec(memcg, nid); 5565 5566 5566 5567 if (swappiness < MIN_SWAPPINESS) ··· 5598 5597 .may_swap = true, 5599 5598 .reclaim_idx = MAX_NR_ZONES - 1, 5600 5599 .gfp_mask = GFP_KERNEL, 5600 + .proactive = true, 5601 5601 }; 5602 5602 5603 5603 buf = kvmalloc(len + 1, GFP_KERNEL);