From: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>
To: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
Cc: Sachin Kamat
<sachin.kamat-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
Balbir Singh
<bsingharora-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
KAMEZAWA Hiroyuki
<kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Subject: Re: [PATCH] mm/memcontrol.c: Remove duplicate inclusion of sock.h file
Date: Wed, 12 Sep 2012 15:09:35 +0200 [thread overview]
Message-ID: <20120912130935.GJ21579@dhcp22.suse.cz> (raw)
In-Reply-To: <20120912125647.GH21579-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
On Wed 12-09-12 14:56:47, Michal Hocko wrote:
> On Wed 12-09-12 12:50:41, Glauber Costa wrote:
> [...]
> > >> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > >> index 795e525..85ec9ff 100644
> > >> --- a/mm/memcontrol.c
> > >> +++ b/mm/memcontrol.c
> > >> @@ -50,8 +50,12 @@
> > >> #include <linux/cpu.h>
> > >> #include <linux/oom.h>
> > >> #include "internal.h"
> > >> +
> > >> +#ifdef CONFIG_MEMCG_KMEM
> > >> #include <net/sock.h>
> > >> +#include <net/ip.h>
> > >> #include <net/tcp_memcontrol.h>
> > >> +#endif
> > >>
> > >> #include <asm/uaccess.h>
> > >>
> > >> @@ -326,7 +330,7 @@ struct mem_cgroup {
> > >> struct mem_cgroup_stat_cpu nocpu_base;
> > >> spinlock_t pcp_counter_lock;
> > >>
> > >> -#ifdef CONFIG_INET
> > >> +#ifdef CONFIG_MEMCG_KMEM
> > >> struct tcp_memcontrol tcp_mem;
> > >> #endif
> > >> };
> >
> > If you are changing this, why not test for both? This field will be
> > useless with inet disabled. I usually don't like conditional in
> > structures (note that the "kmem" res counter in my patchsets is not
> > conditional to KMEM!!), but since the decision was made to make this one
> > conditional, I think INET is a much better test. I am fine with both though.
>
> You are right of course. Updated patch bellow:
Bahh. And I managed to send a different patch than I tested...
---
From 0617ff7114bdf424160a8f1533784c837d426ec2 Mon Sep 17 00:00:00 2001
From: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>
Date: Tue, 11 Sep 2012 10:38:42 +0200
Subject: [PATCH] memcg: clean up networking headers file inclusion
Memory controller doesn't need anything from the networking stack unless
CONFIG_MEMCG_KMEM is selected.
Now we are including net/sock.h and net/tcp_memcontrol.h unconditionally
which is not necessary. Moreover struct mem_cgroup contains tcp_mem even
if CONFIG_MEMCG_KMEM is not selected which is not necessary.
Signed-off-by: Sachin Kamat <sachin.kamat-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Signed-off-by: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>
---
mm/memcontrol.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 795e525..1a217b4 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -50,8 +50,12 @@
#include <linux/cpu.h>
#include <linux/oom.h>
#include "internal.h"
+
+#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_INET)
#include <net/sock.h>
+#include <net/ip.h>
#include <net/tcp_memcontrol.h>
+#endif
#include <asm/uaccess.h>
@@ -326,7 +330,7 @@ struct mem_cgroup {
struct mem_cgroup_stat_cpu nocpu_base;
spinlock_t pcp_counter_lock;
-#ifdef CONFIG_INET
+#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_INET)
struct tcp_memcontrol tcp_mem;
#endif
};
@@ -413,8 +417,6 @@ struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s)
/* Writing them here to avoid exposing memcg's inner layout */
#ifdef CONFIG_MEMCG_KMEM
-#include <net/sock.h>
-#include <net/ip.h>
static bool mem_cgroup_is_root(struct mem_cgroup *memcg);
void sock_update_memcg(struct sock *sk)
--
1.7.10.4
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2012-09-12 13:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-11 8:08 [PATCH] mm/memcontrol.c: Remove duplicate inclusion of sock.h file Sachin Kamat
2012-09-11 9:52 ` Michal Hocko
[not found] ` <20120911095200.GB8058-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2012-09-12 3:39 ` Sachin Kamat
2012-09-12 7:25 ` Michal Hocko
[not found] ` <20120912072520.GB17516-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2012-09-12 8:50 ` Glauber Costa
[not found] ` <50504CE1.8030509-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-09-12 12:56 ` Michal Hocko
[not found] ` <20120912125647.GH21579-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2012-09-12 13:09 ` Michal Hocko [this message]
[not found] ` <20120912130935.GJ21579-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2012-09-14 7:58 ` Sachin Kamat
[not found] ` <CAK9yfHwMnC65BvY3RG7duf_Cmt5hf1VLV=vZRag4Mm6nHdQ-GA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-14 8:27 ` Michal Hocko
[not found] ` <20120914082741.GC28039-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2012-09-14 8:32 ` Glauber Costa
[not found] ` <5052EBAD.6060202-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-09-14 9:56 ` 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=20120912130935.GJ21579@dhcp22.suse.cz \
--to=mhocko-alswssmvlrq@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=bsingharora-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
--cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
--cc=kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=sachin.kamat-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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