Message ID | 20180802003201.817-2-guro@fb.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | introduce memory.oom.group | expand |
Hi Roman, On Wed, 1 Aug 2018 17:31:59 -0700 Roman Gushchin <guro@fb.com> wrote: > > 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> I have no idea why my Signed-off-by is attached to this patch (or Andrew's for that matter) ...
On Wed, Aug 1, 2018 at 5:37 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote: > > Hi Roman, > > On Wed, 1 Aug 2018 17:31:59 -0700 Roman Gushchin <guro@fb.com> wrote: > > > > 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> > > I have no idea why my Signed-off-by is attached to this patch (or > Andrew's for that matter) ... > Roman might have picked this patch from linux-next and sent as it is. Shakeel
On Thu, Aug 02, 2018 at 10:36:48AM +1000, Stephen Rothwell wrote: > Hi Roman, > > On Wed, 1 Aug 2018 17:31:59 -0700 Roman Gushchin <guro@fb.com> wrote: > > > > 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> > > I have no idea why my Signed-off-by is attached to this patch (or > Andrew's for that matter) ... Hi Stephen! I've cherry-picked this patch from the next tree, so it got your signed-off-by. Sorry for that! Thanks! Roman
On Wed, 1 Aug 2018, Roman Gushchin wrote: > 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> Acked-by: David Rientjes <rientjes@google.com>
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,