aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2016-10-07 20:00:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-07 21:46:29 -0400
commit2d75807383459c04d457bf2d295fa6ad858507d2 (patch)
tree66463e88f69356ec92d59d1c8416b076181970e6 /net/core/sock.c
parent08ea8c07fb56d6eb8194d8ad408b469544bf2c29 (diff)
mm: memcontrol: consolidate cgroup socket tracking
The cgroup core and the memory controller need to track socket ownership for different purposes, but the tracking sites being entirely different is kind of ugly. Be a better citizen and rename the memory controller callbacks to match the cgroup core callbacks, then move them to the same place. [akpm@linux-foundation.org: coding-style fixes] Link: http://lkml.kernel.org/r/20160914194846.11153-3-hannes@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Tejun Heo <tj@kernel.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Michal Hocko <mhocko@suse.cz> Cc: 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/sock.c')
-rw-r--r--net/core/sock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 038e660ef844..c73e28fc9c2a 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1363,6 +1363,7 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)
1363 slab = prot->slab; 1363 slab = prot->slab;
1364 1364
1365 cgroup_sk_free(&sk->sk_cgrp_data); 1365 cgroup_sk_free(&sk->sk_cgrp_data);
1366 mem_cgroup_sk_free(sk);
1366 security_sk_free(sk); 1367 security_sk_free(sk);
1367 if (slab != NULL) 1368 if (slab != NULL)
1368 kmem_cache_free(slab, sk); 1369 kmem_cache_free(slab, sk);
@@ -1399,6 +1400,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
1399 sock_net_set(sk, net); 1400 sock_net_set(sk, net);
1400 atomic_set(&sk->sk_wmem_alloc, 1); 1401 atomic_set(&sk->sk_wmem_alloc, 1);
1401 1402
1403 mem_cgroup_sk_alloc(sk);
1402 cgroup_sk_alloc(&sk->sk_cgrp_data); 1404 cgroup_sk_alloc(&sk->sk_cgrp_data);
1403 sock_update_classid(&sk->sk_cgrp_data); 1405 sock_update_classid(&sk->sk_cgrp_data);
1404 sock_update_netprioidx(&sk->sk_cgrp_data); 1406 sock_update_netprioidx(&sk->sk_cgrp_data);
@@ -1545,6 +1547,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
1545 newsk->sk_incoming_cpu = raw_smp_processor_id(); 1547 newsk->sk_incoming_cpu = raw_smp_processor_id();
1546 atomic64_set(&newsk->sk_cookie, 0); 1548 atomic64_set(&newsk->sk_cookie, 0);
1547 1549
1550 mem_cgroup_sk_alloc(newsk);
1548 cgroup_sk_alloc(&newsk->sk_cgrp_data); 1551 cgroup_sk_alloc(&newsk->sk_cgrp_data);
1549 1552
1550 /* 1553 /*
@@ -1569,9 +1572,6 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
1569 sk_set_socket(newsk, NULL); 1572 sk_set_socket(newsk, NULL);
1570 newsk->sk_wq = NULL; 1573 newsk->sk_wq = NULL;
1571 1574
1572 if (mem_cgroup_sockets_enabled && sk->sk_memcg)
1573 sock_update_memcg(newsk);
1574
1575 if (newsk->sk_prot->sockets_allocated) 1575 if (newsk->sk_prot->sockets_allocated)
1576 sk_sockets_allocated_inc(newsk); 1576 sk_sockets_allocated_inc(newsk);
1577 1577