aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2016-01-14 18:21:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-14 19:00:49 -0500
commit3d596f7b907b0281b997cf30c92994a71ad0a1a9 (patch)
treec039825abb7b78cc1cbe3d06e2a2fe481f81f3af /net/core
parent931f3f4beb031cd483c1c8ab159ef1f8bdbe8888 (diff)
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 <hannes@cmpxchg.org> Acked-by: David S. Miller <davem@davemloft.net> Reviewed-by: Vladimir Davydov <vdavydov@virtuozzo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 51270238e269..6c5dab01105b 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1507,12 +1507,6 @@ void sk_free(struct sock *sk)
1507} 1507}
1508EXPORT_SYMBOL(sk_free); 1508EXPORT_SYMBOL(sk_free);
1509 1509
1510static void sk_update_clone(const struct sock *sk, struct sock *newsk)
1511{
1512 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1513 sock_update_memcg(newsk);
1514}
1515
1516/** 1510/**
1517 * sk_clone_lock - clone a socket, and lock its clone 1511 * sk_clone_lock - clone a socket, and lock its clone
1518 * @sk: the socket to clone 1512 * @sk: the socket to clone
@@ -1607,7 +1601,8 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
1607 sk_set_socket(newsk, NULL); 1601 sk_set_socket(newsk, NULL);
1608 newsk->sk_wq = NULL; 1602 newsk->sk_wq = NULL;
1609 1603
1610 sk_update_clone(sk, newsk); 1604 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1605 sock_update_memcg(newsk);
1611 1606
1612 if (newsk->sk_prot->sockets_allocated) 1607 if (newsk->sk_prot->sockets_allocated)
1613 sk_sockets_allocated_inc(newsk); 1608 sk_sockets_allocated_inc(newsk);