aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
authorJohannes Weiner <[email protected]>2016-01-14 23:21:05 +0000
committerLinus Torvalds <[email protected]>2016-01-15 00:00:49 +0000
commit3d596f7b907b0281b997cf30c92994a71ad0a1a9 (patch)
treec039825abb7b78cc1cbe3d06e2a2fe481f81f3af /net/ipv4/tcp_ipv4.c
parentnet: tcp_memcontrol: remove bogus hierarchy pressure propagation (diff)
downloadkernel-3d596f7b907b0281b997cf30c92994a71ad0a1a9.tar.gz
kernel-3d596f7b907b0281b997cf30c92994a71ad0a1a9.zip
net: tcp_memcontrol: protect all tcp_memcontrol calls by jump-label
Move the jump-label from sock_update_memcg() and sock_release_memcg() to the callsite, and so eliminate those function calls when socket accounting is not enabled. This also eliminates the need for dummy functions because the calls will be optimized away if the Kconfig options are not enabled. Signed-off-by: Johannes Weiner <[email protected]> Acked-by: David S. Miller <[email protected]> Reviewed-by: Vladimir Davydov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 65947c1f4733..eb39e02899e5 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1818,7 +1818,9 @@ void tcp_v4_destroy_sock(struct sock *sk)
tcp_saved_syn_free(tp);
sk_sockets_allocated_dec(sk);
- sock_release_memcg(sk);
+
+ if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
+ sock_release_memcg(sk);
}
EXPORT_SYMBOL(tcp_v4_destroy_sock);