From: Michal Hocko <mhocko@suse.cz>
To: Glauber Costa <glommer@parallels.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, Sachin Kamat <sachin.kamat@linaro.org>
Subject: Re: [PATCH v2] memcg: clean up networking headers file inclusion
Date: Fri, 14 Sep 2012 14:13:09 +0200 [thread overview]
Message-ID: <20120914121309.GM28039@dhcp22.suse.cz> (raw)
In-Reply-To: <5052E550.9000506@parallels.com>
On Fri 14-09-12 12:05:36, Glauber Costa wrote:
> On 09/14/2012 04:01 PM, Michal Hocko wrote:
> > On Fri 14-09-12 15:35:50, Glauber Costa wrote:
> >> On 09/14/2012 03:34 PM, Michal Hocko wrote:
> >>> On Fri 14-09-12 15:21:29, Glauber Costa wrote:
> >>>> On 09/14/2012 03:21 PM, Michal Hocko wrote:
> >>>>> Hi,
> >>>>> so I did some more changes to ifdefery of sock kmem part. The patch is
> >>>>> below.
> >>>>> Glauber please have a look at it. I do not think any of the
> >>>>> functionality wrapped inside CONFIG_MEMCG_KMEM without CONFIG_INET is
> >>>>> reusable for generic CONFIG_MEMCG_KMEM, right?
> >>>> Almost right.
> >>>>
> >>>>
> >>>>
> >>>>> }
> >>>>>
> >>>>> /* Writing them here to avoid exposing memcg's inner layout */
> >>>>> -#ifdef CONFIG_MEMCG_KMEM
> >>>>> -#include <net/sock.h>
> >>>>> -#include <net/ip.h>
> >>>>> +#if defined(CONFIG_INET) && defined(CONFIG_MEMCG_KMEM)
> >>>>>
> >>>>> static bool mem_cgroup_is_root(struct mem_cgroup *memcg);
> >>>>
> >>>> This one is. ^^^^
> >>>
> >>> But this is just a forward declaration. And btw. it makes my compiler
> >>> complain about:
> >>> mm/memcontrol.c:421: warning: a??mem_cgroup_is_roota?? declared inline after being called
> >>> mm/memcontrol.c:421: warning: previous declaration of a??mem_cgroup_is_roota?? was here
> >>>
> >>> But I didn't care much yet. It is probaly that my compiler is too old to
> >>> be clever about this.
> >>>
> >> Weird, this code is in tree for a long time.
> >
> > Yes I think it is just compiler issue. Anyway the trivial patch bellow
> > does the trick.
>
> That seems to be alright, and it works for me as well.
OK, I will post it on top of the last version.
>
>
> > ---
> > From 28a803e6e07c5b7ae6b88d7b26801666781aa899 Mon Sep 17 00:00:00 2001
> > From: Michal Hocko <mhocko@suse.cz>
> > Date: Fri, 14 Sep 2012 13:56:32 +0200
> > Subject: [PATCH] memcg: move mem_cgroup_is_root upwards
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: 8bit
> >
> > kmem code uses this function and it is better to not use forward
> > declarations for static inline functions as some (older) compilers don't
> > like it:
> >
> > gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux)
> >
> > mm/memcontrol.c:421: warning: a??mem_cgroup_is_roota?? declared inline after being called
> > mm/memcontrol.c:421: warning: previous declaration of a??mem_cgroup_is_roota?? was here
> >
> > Signed-off-by: Michal Hocko <mhocko@suse.cz>
> > ---
> > mm/memcontrol.c | 11 +++++------
> > 1 file changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 0cd25e9..df69552 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -415,10 +415,14 @@ struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s)
> > return container_of(s, struct mem_cgroup, css);
> > }
> >
> > +static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
> > +{
> > + return (memcg == root_mem_cgroup);
> > +}
> > +
> > /* Writing them here to avoid exposing memcg's inner layout */
> > #if defined(CONFIG_INET) && defined(CONFIG_MEMCG_KMEM)
> >
> > -static bool mem_cgroup_is_root(struct mem_cgroup *memcg);
> > void sock_update_memcg(struct sock *sk)
> > {
> > if (mem_cgroup_sockets_enabled) {
> > @@ -1014,11 +1018,6 @@ void mem_cgroup_iter_break(struct mem_cgroup *root,
> > iter != NULL; \
> > iter = mem_cgroup_iter(NULL, iter, NULL))
> >
> > -static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
> > -{
> > - return (memcg == root_mem_cgroup);
> > -}
> > -
> > void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
> > {
> > struct mem_cgroup *memcg;
> >
>
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-09-14 12:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-14 11:21 Michal Hocko
2012-09-14 11:21 ` Glauber Costa
2012-09-14 11:34 ` Michal Hocko
2012-09-14 11:35 ` Glauber Costa
2012-09-14 12:01 ` Michal Hocko
2012-09-14 8:05 ` Glauber Costa
2012-09-14 12:13 ` Michal Hocko [this message]
2012-09-14 12:08 ` [PATCH v3] " Michal Hocko
2012-09-14 8:14 ` Glauber Costa
2012-09-14 12:24 ` Michal Hocko
2012-09-14 12:41 ` Fengguang Wu
2012-09-14 12:54 ` Michal Hocko
2012-09-14 12:18 ` [PATCH] " Michal Hocko
2012-09-14 19:45 ` [PATCH v3] " Andrew Morton
2012-09-17 12:02 ` [PATCH v4] memcg: cleanup kmem tcp ifdefs Michal Hocko
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=20120914121309.GM28039@dhcp22.suse.cz \
--to=mhocko@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=glommer@parallels.com \
--cc=linux-mm@kvack.org \
--cc=sachin.kamat@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox