Message ID | 20180730180100.25079-2-guro@fb.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | introduce memory.oom.group | expand |
On Mon 30-07-18 11:00:58, Roman Gushchin wrote: > Introduce the mem_cgroup_put() helper, which helps to eliminate guarding > memcg css release with "#ifdef CONFIG_MEMCG" in multiple places. Is there any reason for this to be a separate patch? I usually do not like to add helpers without their users because this makes review harder. This one is quite trivial to fit into Patch3 easilly. > 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> > Cc: Shakeel Butt <shakeelb@google.com> > Cc: Johannes Weiner <hannes@cmpxchg.org> > Cc: 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 >
On Tue, Jul 31, 2018 at 1:45 AM Michal Hocko <mhocko@kernel.org> wrote: > > On Mon 30-07-18 11:00:58, Roman Gushchin wrote: > > Introduce the mem_cgroup_put() helper, which helps to eliminate guarding > > memcg css release with "#ifdef CONFIG_MEMCG" in multiple places. > > Is there any reason for this to be a separate patch? I usually do not > like to add helpers without their users because this makes review > harder. This one is quite trivial to fit into Patch3 easilly. > The helper function introduced in this change is also used in the remote charging patches, so, I asked Roman to separate this change out and thus can be merged independently. Shakeel > > 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> > > Cc: Shakeel Butt <shakeelb@google.com> > > Cc: Johannes Weiner <hannes@cmpxchg.org> > > Cc: 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 > > > > -- > Michal Hocko > SUSE Labs
On Tue 31-07-18 07:58:00, Shakeel Butt wrote: > On Tue, Jul 31, 2018 at 1:45 AM Michal Hocko <mhocko@kernel.org> wrote: > > > > On Mon 30-07-18 11:00:58, Roman Gushchin wrote: > > > Introduce the mem_cgroup_put() helper, which helps to eliminate guarding > > > memcg css release with "#ifdef CONFIG_MEMCG" in multiple places. > > > > Is there any reason for this to be a separate patch? I usually do not > > like to add helpers without their users because this makes review > > harder. This one is quite trivial to fit into Patch3 easilly. > > > > The helper function introduced in this change is also used in the > remote charging patches, so, I asked Roman to separate this change out > and thus can be merged independently. Ok, that was not clear from the description. Then this is ok Acked-by: Michal Hocko <mhocko@suse.com> > Shakeel > > > > 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> > > > Cc: Shakeel Butt <shakeelb@google.com> > > > Cc: Johannes Weiner <hannes@cmpxchg.org> > > > Cc: 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 > > > > > > > -- > > Michal Hocko > > SUSE Labs
On Mon, Jul 30, 2018 at 11:00:58AM -0700, 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> > Cc: Shakeel Butt <shakeelb@google.com> > Cc: Johannes Weiner <hannes@cmpxchg.org> > Cc: 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: Johannes Weiner <hannes@cmpxchg.org>
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,