Skip to contentSkip to conversation

mm: memcg: expose mem_cgroup_put API

PATCH In review Shakeel Butt 2 participants 4 messages Mar 8, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: memcg: expose mem_cgroup_put API

This patch exports mem_cgroup_put API to put the refcnt of the memory cgroup.

---
 include/linux/memcontrol.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/linux/memcontrol.h +9 -0
index c46016bb25eb..0da79e116a07 100644
@@ -344,6 +344,11 @@ struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css){
 	return css ? container_of(css, struct mem_cgroup, css) : NULL;
 }
 
+static inline void mem_cgroup_put(struct mem_cgroup *memcg)
+{
+	css_put(&memcg->css);
+}
+
 #define mem_cgroup_from_counter(counter, member)	\
 	container_of(counter, struct mem_cgroup, member)
 
@@ -789,6 +794,10 @@ static inline bool task_in_mem_cgroup(struct task_struct *task,
 	return true;
 }
 
+static inline void mem_cgroup_put(struct mem_cgroup *memcg)
+{
+}
+
 static inline struct mem_cgroup *
 mem_cgroup_iter(struct mem_cgroup *root,
 		struct mem_cgroup *prev,
Signature · 1 line
2.16.2.395.g2e18187dfd-goog
maintainer
#1 lore raw
Quoted 2 lines · On Wed, 7 Mar 2018 18:48:50 -0800 Shakeel Butt <[email protected]> wrote:

This patch exports mem_cgroup_put API to put the refcnt of the memory cgroup.

Not the best of changelogs :(

Why is this patch being added?

It's a prerequisite for <I-forget-which-patch> isn't it?

maintainer
#2 lore raw
In reply to Shakeel Butt
Quoted 2 lines · On Wed, 7 Mar 2018 18:48:50 -0800 Shakeel Butt <[email protected]> wrote:

This patch exports mem_cgroup_put API to put the refcnt of the memory cgroup.

OK, I remember now. This is intended to make fs-fsnotify-account-fsnotify-metadata-to-kmemcg.patch independent of mm-oom-cgroup-aware-oom-killer.patch by extracting mem_cgroup_put() from mm-oom-cgroup-aware-oom-killer.patch.

However it will not permit me to stage fs-fsnotify-account-fsnotify-metadata-to-kmemcg.patch ahead of mm-oom-cgroup-aware-oom-killer.patch because there are quite a lot of syntactic clashes.

I can resolve those if needed, but am keenly hoping that the mm-oom-cgroup-aware-oom-killer.patch issues are resolved soon so there isn't a need to do this.

#3 lore raw
Quoted 9 lines · Andrew Morton
Quoted 2 lines · On Wed, 7 Mar 2018 18:48:50 -0800 Shakeel Butt <[email protected]> wrote:

This patch exports mem_cgroup_put API to put the refcnt of the memory cgroup.

OK, I remember now. This is intended to make fs-fsnotify-account-fsnotify-metadata-to-kmemcg.patch independent of mm-oom-cgroup-aware-oom-killer.patch by extracting mem_cgroup_put() from mm-oom-cgroup-aware-oom-killer.patch.

Yes, you are right, it is needed by the above fsnotify patch.

Quoted 9 lines

However it will not permit me to stage fs-fsnotify-account-fsnotify-metadata-to-kmemcg.patch ahead of mm-oom-cgroup-aware-oom-killer.patch because there are quite a lot of syntactic clashes.

I can resolve those if needed, but am keenly hoping that the mm-oom-cgroup-aware-oom-killer.patch issues are resolved soon so there isn't a need to do this.

Sounds good to me.