From: Roman Gushchin <guro@fb.com>
To: linux-mm@kvack.org
Cc: Michal Hocko <mhocko@suse.com>,
Johannes Weiner <hannes@cmpxchg.org>,
David Rientjes <rientjes@google.com>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Tejun Heo <tj@kernel.org>,
kernel-team@fb.com, linux-kernel@vger.kernel.org,
Roman Gushchin <guro@fb.com>,
Andrew Morton <akpm@linux-foundation.org>,
Stephen Rothwell <sfr@canb.auug.org.au>
Subject: [PATCH v2 1/3] mm: introduce mem_cgroup_put() helper
Date: Wed, 1 Aug 2018 17:31:59 -0700 [thread overview]
Message-ID: <20180802003201.817-2-guro@fb.com> (raw)
In-Reply-To: <20180802003201.817-1-guro@fb.com>
Introduce the mem_cgroup_put() helper, which helps to eliminate guarding
memcg css release with "#ifdef CONFIG_MEMCG" in multiple places.
Link: http://lkml.kernel.org/r/20180623000600.5818-2-guro@fb.com
Signed-off-by: Roman Gushchin <guro@fb.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
include/linux/memcontrol.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 6c6fb116e925..e53e00cdbe3f 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -375,6 +375,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)
@@ -837,6 +842,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,
--
2.14.4
WARNING: multiple messages have this Message-ID (diff)
From: Roman Gushchin <guro@fb.com>
To: <linux-mm@kvack.org>
Cc: Michal Hocko <mhocko@suse.com>,
Johannes Weiner <hannes@cmpxchg.org>,
David Rientjes <rientjes@google.com>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Tejun Heo <tj@kernel.org>, <kernel-team@fb.com>,
<linux-kernel@vger.kernel.org>, Roman Gushchin <guro@fb.com>,
Andrew Morton <akpm@linux-foundation.org>,
Stephen Rothwell <sfr@canb.auug.org.au>
Subject: [PATCH v2 1/3] mm: introduce mem_cgroup_put() helper
Date: Wed, 1 Aug 2018 17:31:59 -0700 [thread overview]
Message-ID: <20180802003201.817-2-guro@fb.com> (raw)
In-Reply-To: <20180802003201.817-1-guro@fb.com>
Introduce the mem_cgroup_put() helper, which helps to eliminate guarding
memcg css release with "#ifdef CONFIG_MEMCG" in multiple places.
Link: http://lkml.kernel.org/r/20180623000600.5818-2-guro@fb.com
Signed-off-by: Roman Gushchin <guro@fb.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
include/linux/memcontrol.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 6c6fb116e925..e53e00cdbe3f 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -375,6 +375,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)
@@ -837,6 +842,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,
--
2.14.4
next prev parent reply other threads:[~2018-08-02 0:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 0:31 [PATCH v2 0/3] introduce memory.oom.group Roman Gushchin
2018-08-02 0:31 ` Roman Gushchin
2018-08-02 0:31 ` Roman Gushchin [this message]
2018-08-02 0:31 ` [PATCH v2 1/3] mm: introduce mem_cgroup_put() helper Roman Gushchin
2018-08-02 0:36 ` Stephen Rothwell
2018-08-02 0:36 ` Stephen Rothwell
2018-08-02 0:47 ` Shakeel Butt
2018-08-02 0:50 ` Roman Gushchin
2018-08-02 0:50 ` Roman Gushchin
2018-08-06 21:44 ` David Rientjes
2018-08-02 0:32 ` [PATCH v2 2/3] mm, oom: refactor oom_kill_process() Roman Gushchin
2018-08-02 0:32 ` Roman Gushchin
2018-08-02 0:32 ` [PATCH v2 3/3] mm, oom: introduce memory.oom.group Roman Gushchin
2018-08-02 0:32 ` Roman Gushchin
2018-08-02 10:53 ` Tetsuo Handa
2018-08-02 11:21 ` Michal Hocko
2018-08-02 11:53 ` Tetsuo Handa
2018-08-02 12:14 ` Michal Hocko
2018-08-02 16:56 ` Roman Gushchin
2018-08-02 16:56 ` Roman Gushchin
2018-08-02 18:48 ` Tejun Heo
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=20180802003201.817-2-guro@fb.com \
--to=guro@fb.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=rientjes@google.com \
--cc=sfr@canb.auug.org.au \
--cc=tj@kernel.org \
/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.