* [merged mm-stable] memcontrol-rename-mem_cgroup_scan_tasks.patch removed from -mm tree
@ 2025-05-13 6:55 Andrew Morton
2025-05-13 15:58 ` Shakeel Butt
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2025-05-13 6:55 UTC (permalink / raw)
To: mm-commits, yang.yang29, wang.yaxin, songmuchun, shakeel.butt,
roman.gushchin, muchun.song, mhocko, mhocko, hannes, david,
chen.haonan2, xu.xin16, akpm
The quilt patch titled
Subject: memcontrol: rename mem_cgroup_scan_tasks()
has been removed from the -mm tree. Its filename was
memcontrol-rename-mem_cgroup_scan_tasks.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: rename mem_cgroup_scan_tasks()
Date: Thu, 1 May 2025 04:11:34 +0000
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 patchset 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
This implementation supports both cgroup v2 and cgroup v1.
This patch (of 9):
Current Issue:
==============
mem_cgroup_scan_tasks in memcontrol.c has a naming ambiguity. While its
name suggests it only iterates through processes belonging to the current
memcgroup, it actually scans all descendant cgroups under the subtree
rooted at this memcgroup. This discrepancy can cause confusion for
developers relying on the semantic meaning of the function name.
Resolution:
===========
Renaming: We have renamed the original function to
**mem_cgroup_tree_scan_tasks** to explicitly reflect its subtree-traversal
behavior.
A subsequent patch will introduce a new mem_cgroup_scan_tasks function
that strictly iterates processes only within the current memcgroup,
aligning its behavior with its name.
Link: https://lkml.kernel.org/r/20250501120854885LyBCW0syCGojqnJ8crLVl@zte.com.cn
Link: https://lkml.kernel.org/r/20250501041134.3324145-1-xu.xin16@zte.com.cn
Signed-off-by: xu xin <xu.xin16@zte.com.cn>
Cc: David Hildenbrand <david@redhat.com>
Cc: Wang Yaxin <wang.yaxin@zte.com.cn>
Cc: Yang Yang <yang.yang29@zte.com.cn>
Cc: Haonan Chen <chen.haonan2@zte.com.cn>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/memcontrol.h | 4 ++--
mm/memcontrol.c | 4 ++--
mm/oom_kill.c | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
--- a/include/linux/memcontrol.h~memcontrol-rename-mem_cgroup_scan_tasks
+++ a/include/linux/memcontrol.h
@@ -795,7 +795,7 @@ struct mem_cgroup *mem_cgroup_iter(struc
struct mem_cgroup *,
struct mem_cgroup_reclaim_cookie *);
void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *);
-void mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
+void mem_cgroup_tree_scan_tasks(struct mem_cgroup *memcg,
int (*)(struct task_struct *, void *), void *arg);
static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
@@ -1290,7 +1290,7 @@ static inline void mem_cgroup_iter_break
{
}
-static inline void mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
+static inline void mem_cgroup_tree_scan_tasks(struct mem_cgroup *memcg,
int (*fn)(struct task_struct *, void *), void *arg)
{
}
--- a/mm/memcontrol.c~memcontrol-rename-mem_cgroup_scan_tasks
+++ a/mm/memcontrol.c
@@ -1166,7 +1166,7 @@ static void invalidate_reclaim_iterators
}
/**
- * mem_cgroup_scan_tasks - iterate over tasks of a memory cgroup hierarchy
+ * mem_cgroup_tree_scan_tasks - iterate over tasks of a memory cgroup hierarchy
* @memcg: hierarchy root
* @fn: function to call for each task
* @arg: argument passed to @fn
@@ -1178,7 +1178,7 @@ static void invalidate_reclaim_iterators
*
* This function must not be called for the root memory cgroup.
*/
-void mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
+void mem_cgroup_tree_scan_tasks(struct mem_cgroup *memcg,
int (*fn)(struct task_struct *, void *), void *arg)
{
struct mem_cgroup *iter;
--- a/mm/oom_kill.c~memcontrol-rename-mem_cgroup_scan_tasks
+++ a/mm/oom_kill.c
@@ -367,7 +367,7 @@ static void select_bad_process(struct oo
oc->chosen_points = LONG_MIN;
if (is_memcg_oom(oc))
- mem_cgroup_scan_tasks(oc->memcg, oom_evaluate_task, oc);
+ mem_cgroup_tree_scan_tasks(oc->memcg, oom_evaluate_task, oc);
else {
struct task_struct *p;
@@ -428,7 +428,7 @@ static void dump_tasks(struct oom_contro
pr_info("[ pid ] uid tgid total_vm rss rss_anon rss_file rss_shmem pgtables_bytes swapents oom_score_adj name\n");
if (is_memcg_oom(oc))
- mem_cgroup_scan_tasks(oc->memcg, dump_task, oc);
+ mem_cgroup_tree_scan_tasks(oc->memcg, dump_task, oc);
else {
struct task_struct *p;
int i = 0;
@@ -1056,7 +1056,7 @@ static void oom_kill_process(struct oom_
if (oom_group) {
memcg_memory_event(oom_group, MEMCG_OOM_GROUP_KILL);
mem_cgroup_print_oom_group(oom_group);
- mem_cgroup_scan_tasks(oom_group, oom_kill_memcg_member,
+ mem_cgroup_tree_scan_tasks(oom_group, oom_kill_memcg_member,
(void *)message);
mem_cgroup_put(oom_group);
}
_
Patches currently in -mm which might be from xu.xin16@zte.com.cn are
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [merged mm-stable] memcontrol-rename-mem_cgroup_scan_tasks.patch removed from -mm tree
2025-05-13 6:55 [merged mm-stable] memcontrol-rename-mem_cgroup_scan_tasks.patch removed from -mm tree Andrew Morton
@ 2025-05-13 15:58 ` Shakeel Butt
2025-05-13 23:29 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Shakeel Butt @ 2025-05-13 15:58 UTC (permalink / raw)
To: Andrew Morton
Cc: mm-commits, yang.yang29, wang.yaxin, songmuchun, roman.gushchin,
muchun.song, mhocko, mhocko, hannes, david, chen.haonan2,
xu.xin16
On Mon, May 12, 2025 at 11:55:31PM -0700, Andrew Morton wrote:
>
> The quilt patch titled
> Subject: memcontrol: rename mem_cgroup_scan_tasks()
> has been removed from the -mm tree. Its filename was
> memcontrol-rename-mem_cgroup_scan_tasks.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: rename mem_cgroup_scan_tasks()
> Date: Thu, 1 May 2025 04:11:34 +0000
>
> 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 patchset 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
>
> This implementation supports both cgroup v2 and cgroup v1.
>
>
> This patch (of 9):
>
> Current Issue:
> ==============
> mem_cgroup_scan_tasks in memcontrol.c has a naming ambiguity. While its
> name suggests it only iterates through processes belonging to the current
> memcgroup, it actually scans all descendant cgroups under the subtree
> rooted at this memcgroup. This discrepancy can cause confusion for
> developers relying on the semantic meaning of the function name.
>
> Resolution:
> ===========
> Renaming: We have renamed the original function to
> **mem_cgroup_tree_scan_tasks** to explicitly reflect its subtree-traversal
> behavior.
>
> A subsequent patch will introduce a new mem_cgroup_scan_tasks function
> that strictly iterates processes only within the current memcgroup,
> aligning its behavior with its name.
>
> Link: https://lkml.kernel.org/r/20250501120854885LyBCW0syCGojqnJ8crLVl@zte.com.cn
> Link: https://lkml.kernel.org/r/20250501041134.3324145-1-xu.xin16@zte.com.cn
> Signed-off-by: xu xin <xu.xin16@zte.com.cn>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Wang Yaxin <wang.yaxin@zte.com.cn>
> Cc: Yang Yang <yang.yang29@zte.com.cn>
> Cc: Haonan Chen <chen.haonan2@zte.com.cn>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Roman Gushchin <roman.gushchin@linux.dev>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Shakeel Butt <shakeel.butt@linux.dev>
> Cc: Muchun Song <songmuchun@bytedance.com>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Muchun Song <muchun.song@linux.dev>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
Hi Andrew, can you please keep this series on hold for now? The
discussion has not concluded yet. Mainly I want to see system level
metrics which can get included in memcg and exposed through memory.stat
interface instead of a new one.
thanks,
Shakeel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [merged mm-stable] memcontrol-rename-mem_cgroup_scan_tasks.patch removed from -mm tree
2025-05-13 15:58 ` Shakeel Butt
@ 2025-05-13 23:29 ` Andrew Morton
2025-05-14 1:25 ` Shakeel Butt
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2025-05-13 23:29 UTC (permalink / raw)
To: Shakeel Butt
Cc: mm-commits, yang.yang29, wang.yaxin, songmuchun, roman.gushchin,
muchun.song, mhocko, mhocko, hannes, david, chen.haonan2,
xu.xin16
On Tue, 13 May 2025 08:58:21 -0700 Shakeel Butt <shakeel.butt@linux.dev> wrote:
> Hi Andrew, can you please keep this series on hold for now? The
> discussion has not concluded yet. Mainly I want to see system level
> metrics which can get included in memcg and exposed through memory.stat
> interface instead of a new one.
OK, I dropped these from mm-stable so they aren't in mm.git at all.
Should I re-add these patches to mm-unstable?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [merged mm-stable] memcontrol-rename-mem_cgroup_scan_tasks.patch removed from -mm tree
2025-05-13 23:29 ` Andrew Morton
@ 2025-05-14 1:25 ` Shakeel Butt
0 siblings, 0 replies; 4+ messages in thread
From: Shakeel Butt @ 2025-05-14 1:25 UTC (permalink / raw)
To: Andrew Morton
Cc: mm-commits, yang.yang29, wang.yaxin, songmuchun, roman.gushchin,
muchun.song, mhocko, mhocko, hannes, david, chen.haonan2,
xu.xin16
On Tue, May 13, 2025 at 04:29:06PM -0700, Andrew Morton wrote:
> On Tue, 13 May 2025 08:58:21 -0700 Shakeel Butt <shakeel.butt@linux.dev> wrote:
>
> > Hi Andrew, can you please keep this series on hold for now? The
> > discussion has not concluded yet. Mainly I want to see system level
> > metrics which can get included in memcg and exposed through memory.stat
> > interface instead of a new one.
>
> OK, I dropped these from mm-stable so they aren't in mm.git at all.
> Should I re-add these patches to mm-unstable?
I don't have a strong opinion on that but I don't see any benefit of
bots testing this series which mm-unstable gets.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-14 1:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-13 6:55 [merged mm-stable] memcontrol-rename-mem_cgroup_scan_tasks.patch removed from -mm tree Andrew Morton
2025-05-13 15:58 ` Shakeel Butt
2025-05-13 23:29 ` Andrew Morton
2025-05-14 1:25 ` Shakeel Butt
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.