linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 0/6] support ksm_stat showing at cgroup level
@ 2025-04-22 11:14 xu.xin16
  2025-04-22 11:19 ` [PATCH RESEND 1/6] memcontrol: rename mem_cgroup_scan_tasks() xu xin
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: xu.xin16 @ 2025-04-22 11:14 UTC (permalink / raw)
  To: akpm; +Cc: david, linux-kernel, wang.yaxin, linux-mm, linux-fsdevel,
	yang.yang29

From: xu xin <xu.xin16@zte.com.cn>

With the enablement of container-level KSM (e.g., via prctl [1]), there is
a growing demand for container-level observability of KSM behavior. However,
current cgroup implementations lack support for exposing KSM-related
metrics.

This patch introduces a new interface named ksm_stat
at the cgroup hierarchy level, enabling users to monitor KSM merging
statistics specifically for containers where this feature has been
activated, eliminating the need to manually inspect KSM information for
each individual process within the cgroup.

Users can obtain the KSM information of a cgroup just by:

# cat /sys/fs/cgroup/memory.ksm_stat
ksm_rmap_items 76800
ksm_zero_pages 0
ksm_merging_pages 76800
ksm_process_profit 309657600

Current implementation supports cgroup v1 temporarily; cgroup v2
compatibility is planned for future versions.


xu xin (6):
  memcontrol: rename mem_cgroup_scan_tasks()
  memcontrol: introduce the new mem_cgroup_scan_tasks()
  memcontrol-v1: introduce ksm_stat at cgroup level
  memcontrol-v1: add ksm_zero_pages in cgroup/memory.ksm_stat
  memcontrol-v1: add ksm_merging_pages in cgroup/memory.ksm_stat
  memcontrol-v1: add ksm_profit in cgroup/memory.ksm_stat

 include/linux/memcontrol.h |  7 +++++
 mm/memcontrol-v1.c         | 55 ++++++++++++++++++++++++++++++++++++++
 mm/memcontrol.c            | 28 +++++++++++++++++--
 mm/oom_kill.c              |  6 ++---
 4 files changed, 91 insertions(+), 5 deletions(-)

-- 
2.39.3

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

end of thread, other threads:[~2025-04-25 14:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-22 11:14 [PATCH RESEND 0/6] support ksm_stat showing at cgroup level xu.xin16
2025-04-22 11:19 ` [PATCH RESEND 1/6] memcontrol: rename mem_cgroup_scan_tasks() xu xin
2025-04-22 23:29   ` Andrew Morton
2025-04-23 12:22     ` Matthew Wilcox
2025-04-25 14:30       ` Michal Hocko
2025-04-22 11:20 ` [PATCH RESEND 2/6] memcontrol: introduce the new mem_cgroup_scan_tasks() xu xin
2025-04-22 11:21 ` [PATCH RESEND 3/6] memcontrol-v1: introduce ksm_stat at cgroup level xu xin
2025-04-22 11:21 ` [PATCH RESEND 4/6] memcontrol-v1: add ksm_zero_pages in cgroup/memory.ksm_stat xu xin
2025-04-22 11:22 ` [PATCH RESEND 5/6] memcontrol-v1: add ksm_merging_pages " xu xin
2025-04-22 11:22 ` [PATCH RESEND 6/6] memcontrol-v1: add ksm_profit " xu xin
2025-04-23  8:21   ` kernel test robot
2025-04-23 13:08 ` [PATCH RESEND 0/6] support ksm_stat showing at cgroup level David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).