linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/9] support ksm_stat showing at cgroup level
@ 2025-05-01  4:08 xu.xin16
  2025-05-01  4:11 ` [PATCH v2 1/9] memcontrol: rename mem_cgroup_scan_tasks() xu.xin.sc
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: xu.xin16 @ 2025-05-01  4:08 UTC (permalink / raw)
  To: akpm
  Cc: david, linux-kernel, wang.yaxin, linux-mm, linux-fsdevel,
	yang.yang29, xu.xin16

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 both cgroup v2 and cgroup v1.

xu xin (9):
  memcontrol: rename mem_cgroup_scan_tasks()
  memcontrol: introduce the new mem_cgroup_scan_tasks()
  memcontrol: introduce ksm_stat at memcg-v2
  memcontrol: add ksm_zero_pages in cgroup/memory.ksm_stat
  memcontrol: add ksm_merging_pages in cgroup/memory.ksm_stat
  memcontrol: add ksm_profit in cgroup/memory.ksm_stat
  memcontrol-v1: add ksm_stat at memcg-v1
  Documentation: add ksm_stat description in cgroup-v1/memory.rst
  Documentation: add ksm_stat description in cgroup-v2.rst

 Documentation/admin-guide/cgroup-v1/memory.rst | 36 +++++++++++
 Documentation/admin-guide/cgroup-v2.rst        | 12 ++++
 include/linux/memcontrol.h                     | 14 +++++
 mm/memcontrol-v1.c                             |  6 ++
 mm/memcontrol.c                                | 83 +++++++++++++++++++++++++-
 mm/oom_kill.c                                  |  6 +-
 6 files changed, 152 insertions(+), 5 deletions(-)

-- 
2.15.2


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

end of thread, other threads:[~2025-06-02 14:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-01  4:08 [PATCH v2 0/9] support ksm_stat showing at cgroup level xu.xin16
2025-05-01  4:11 ` [PATCH v2 1/9] memcontrol: rename mem_cgroup_scan_tasks() xu.xin.sc
2025-05-01  4:13 ` [PATCH v2 2/9] memcontrol: introduce the new mem_cgroup_scan_tasks() xu.xin.sc
2025-05-01  4:14 ` [PATCH v2 3/9] memcontrol: introduce ksm_stat at memcg-v2 xu.xin.sc
2025-05-01  4:14 ` [PATCH v2 4/9] memcontrol: add ksm_zero_pages in cgroup/memory.ksm_stat xu.xin.sc
2025-05-01  4:15 ` [PATCH v2 5/9] memcontrol: add ksm_merging_pages " xu.xin.sc
2025-05-01  4:15 ` [PATCH v2 6/9] memcontrol: add ksm_profit " xu.xin.sc
2025-05-01  4:16 ` [PATCH v2 7/9] memcontrol-v1: add ksm_stat at memcg-v1 xu.xin.sc
2025-05-01  4:17 ` [PATCH v2 8/9] Documentation: add ksm_stat description in cgroup-v1/memory.rst xu.xin.sc
2025-05-01  4:17 ` [PATCH v2 9/9] Documentation: add ksm_stat description in cgroup-v2.rst xu.xin.sc
2025-05-01 20:27 ` [PATCH v2 0/9] support ksm_stat showing at cgroup level Andrew Morton
2025-05-05 21:30 ` Shakeel Butt
2025-05-06  5:09   ` xu.xin16
2025-05-08 18:56     ` Shakeel Butt
2025-06-02 14:14       ` xu.xin16

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