diff mbox

[1/3] net: fix socket memcg build with !CONFIG_NET

Message ID 1327071436-20763-2-git-send-email-glommer@parallels.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Glauber Costa Jan. 20, 2012, 2:57 p.m. UTC
There is still a build bug with the sock memcg code, that triggers
with !CONFIG_NET, that survived my series of randconfig builds.

Signed-off-by: Glauber Costa <glommer@parallels.com>
Reported-by: Randy Dunlap <rdunlap@xenotime.net>
CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>
---
 include/net/sock.h |    2 +-
 mm/memcontrol.c    |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

David Miller Jan. 20, 2012, 7:14 p.m. UTC | #1
From: Glauber Costa <glommer@parallels.com>
Date: Fri, 20 Jan 2012 18:57:14 +0400

> There is still a build bug with the sock memcg code, that triggers
> with !CONFIG_NET, that survived my series of randconfig builds.
> 
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> Reported-by: Randy Dunlap <rdunlap@xenotime.net>
> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>

Why are you undoing the static branch optimization?  That was a one of
the things that made me agree to even putting this code in.

Find a way to fix this without removing the static branch.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Glauber Costa Jan. 21, 2012, 2:17 p.m. UTC | #2
On 01/20/2012 11:14 PM, David Miller wrote:
> From: Glauber Costa<glommer@parallels.com>
> Date: Fri, 20 Jan 2012 18:57:14 +0400
>
>> There is still a build bug with the sock memcg code, that triggers
>> with !CONFIG_NET, that survived my series of randconfig builds.
>>
>> Signed-off-by: Glauber Costa<glommer@parallels.com>
>> Reported-by: Randy Dunlap<rdunlap@xenotime.net>
>> CC: Hiroyouki Kamezawa<kamezawa.hiroyu@jp.fujitsu.com>
>
> Why are you undoing the static branch optimization?  That was a one of
> the things that made me agree to even putting this code in.
>
> Find a way to fix this without removing the static branch.
>
Dave,

I am not removing the static branch. This is just a macro, that expands 
to the static branch when the options are in place, and to 0 if they are 
not.

if (0) { } is certainly be removed to the compiler, so the code is out
anyway.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Jan. 22, 2012, 7:35 p.m. UTC | #3
From: Glauber Costa <glommer@parallels.com>
Date: Sat, 21 Jan 2012 18:17:26 +0400

> I am not removing the static branch. This is just a macro, that
> expands to the static branch when the options are in place, and to 0
> if they are not.
> 
> if (0) { } is certainly be removed to the compiler, so the code is out
> anyway.

That's rather non-intuitive, oh well.

I'll apply this, but all of this stuff is an ifdef mess.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/sock.h b/include/net/sock.h
index bb972d2..3cae112 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -921,7 +921,7 @@  inline void sk_refcnt_debug_release(const struct sock *sk)
 #define sk_refcnt_debug_release(sk) do { } while (0)
 #endif /* SOCK_REFCNT_DEBUG */
 
-#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
+#if defined(CONFIG_CGROUP_MEM_RES_CTLR_KMEM) && defined(CONFIG_NET)
 extern struct jump_label_key memcg_socket_limit_enabled;
 static inline struct cg_proto *parent_cg_proto(struct proto *proto,
 					       struct cg_proto *cg_proto)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3dbff4d..c3688df 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -379,7 +379,7 @@  static void mem_cgroup_put(struct mem_cgroup *memcg);
 static bool mem_cgroup_is_root(struct mem_cgroup *memcg);
 void sock_update_memcg(struct sock *sk)
 {
-	if (static_branch(&memcg_socket_limit_enabled)) {
+	if (mem_cgroup_sockets_enabled) {
 		struct mem_cgroup *memcg;
 
 		BUG_ON(!sk->sk_prot->proto_cgroup);
@@ -411,7 +411,7 @@  EXPORT_SYMBOL(sock_update_memcg);
 
 void sock_release_memcg(struct sock *sk)
 {
-	if (static_branch(&memcg_socket_limit_enabled) && sk->sk_cgrp) {
+	if (mem_cgroup_sockets_enabled && sk->sk_cgrp) {
 		struct mem_cgroup *memcg;
 		WARN_ON(!sk->sk_cgrp->memcg);
 		memcg = sk->sk_cgrp->memcg;