From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,yang.yang29@zte.com.cn,wang.yaxin@zte.com.cn,songmuchun@bytedance.com,shakeel.butt@linux.dev,roman.gushchin@linux.dev,muchun.song@linux.dev,mhocko@suse.com,mhocko@kernel.org,hannes@cmpxchg.org,david@redhat.com,chen.haonan2@zte.com.cn,xu.xin16@zte.com.cn,akpm@linux-foundation.org
Subject: [merged mm-stable] memcontrol-v1-add-ksm_stat-at-memcg-v1.patch removed from -mm tree
Date: Mon, 12 May 2025 23:55:40 -0700 [thread overview]
Message-ID: <20250513065541.4831FC4CEE4@smtp.kernel.org> (raw)
The quilt patch titled
Subject: memcontrol-v1: add ksm_stat at memcg-v1
has been removed from the -mm tree. Its filename was
memcontrol-v1-add-ksm_stat-at-memcg-v1.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: xu xin <xu.xin16@zte.com.cn>
Subject: memcontrol-v1: add ksm_stat at memcg-v1
Date: Thu, 1 May 2025 04:16:47 +0000
With the enablement of container-level KSM (e.g., via prctl), 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-v1.
Since the implementation of ksm_stat has been added into memcg-v2, this
just add it back to memcg-v1 with the same function of traversing the
process of the memcg.
Users can obtain the KSM information of a cgroup just by:
`cat /sys/fs/cgroup/memory.ksm_stat`
Link: https://lkml.kernel.org/r/20250501041647.3324541-1-xu.xin16@zte.com.cn
Signed-off-by: xu xin <xu.xin16@zte.com.cn>
Cc: David Hildenbrand <david@redhat.com>
Cc: Haonan Chen <chen.haonan2@zte.com.cn>
Cc: Wang Yaxin <wang.yaxin@zte.com.cn>
Cc: Yang Yang <yang.yang29@zte.com.cn>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/memcontrol.h | 7 +++++++
mm/memcontrol-v1.c | 6 ++++++
mm/memcontrol.c | 2 +-
3 files changed, 14 insertions(+), 1 deletion(-)
--- a/include/linux/memcontrol.h~memcontrol-v1-add-ksm_stat-at-memcg-v1
+++ a/include/linux/memcontrol.h
@@ -939,6 +939,8 @@ unsigned long lruvec_page_state(struct l
unsigned long lruvec_page_state_local(struct lruvec *lruvec,
enum node_stat_item idx);
+int memcg_ksm_stat_show(struct seq_file *m, void *v);
+
void mem_cgroup_flush_stats(struct mem_cgroup *memcg);
void mem_cgroup_flush_stats_ratelimited(struct mem_cgroup *memcg);
@@ -1416,6 +1418,11 @@ static inline unsigned long lruvec_page_
return node_page_state(lruvec_pgdat(lruvec), idx);
}
+static inline int memcg_ksm_stat_show(struct seq_file *m, void *v)
+{
+ return 0;
+}
+
static inline void mem_cgroup_flush_stats(struct mem_cgroup *memcg)
{
}
--- a/mm/memcontrol.c~memcontrol-v1-add-ksm_stat-at-memcg-v1
+++ a/mm/memcontrol.c
@@ -4491,7 +4491,7 @@ static int evaluate_memcg_ksm_stat(struc
return 0;
}
-static int memcg_ksm_stat_show(struct seq_file *m, void *v)
+int memcg_ksm_stat_show(struct seq_file *m, void *v)
{
struct memcg_ksm_stat ksm_stat;
struct mem_cgroup *memcg = mem_cgroup_from_seq(m);
--- a/mm/memcontrol-v1.c~memcontrol-v1-add-ksm_stat-at-memcg-v1
+++ a/mm/memcontrol-v1.c
@@ -2080,6 +2080,12 @@ struct cftype mem_cgroup_legacy_files[]
.seq_show = memcg_numa_stat_show,
},
#endif
+#ifdef CONFIG_KSM
+ {
+ .name = "ksm_stat",
+ .seq_show = memcg_ksm_stat_show,
+ },
+#endif
{
.name = "kmem.limit_in_bytes",
.private = MEMFILE_PRIVATE(_KMEM, RES_LIMIT),
_
Patches currently in -mm which might be from xu.xin16@zte.com.cn are
reply other threads:[~2025-05-13 6:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250513065541.4831FC4CEE4@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=chen.haonan2@zte.com.cn \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=mhocko@kernel.org \
--cc=mhocko@suse.com \
--cc=mm-commits@vger.kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=songmuchun@bytedance.com \
--cc=wang.yaxin@zte.com.cn \
--cc=xu.xin16@zte.com.cn \
--cc=yang.yang29@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.