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>
这个提交包含在:
@@ -1363,6 +1363,7 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)
|
||||
slab = prot->slab;
|
||||
|
||||
cgroup_sk_free(&sk->sk_cgrp_data);
|
||||
mem_cgroup_sk_free(sk);
|
||||
security_sk_free(sk);
|
||||
if (slab != NULL)
|
||||
kmem_cache_free(slab, sk);
|
||||
@@ -1399,6 +1400,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
|
||||
sock_net_set(sk, net);
|
||||
atomic_set(&sk->sk_wmem_alloc, 1);
|
||||
|
||||
mem_cgroup_sk_alloc(sk);
|
||||
cgroup_sk_alloc(&sk->sk_cgrp_data);
|
||||
sock_update_classid(&sk->sk_cgrp_data);
|
||||
sock_update_netprioidx(&sk->sk_cgrp_data);
|
||||
@@ -1545,6 +1547,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
|
||||
newsk->sk_incoming_cpu = raw_smp_processor_id();
|
||||
atomic64_set(&newsk->sk_cookie, 0);
|
||||
|
||||
mem_cgroup_sk_alloc(newsk);
|
||||
cgroup_sk_alloc(&newsk->sk_cgrp_data);
|
||||
|
||||
/*
|
||||
@@ -1569,9 +1572,6 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
|
||||
sk_set_socket(newsk, NULL);
|
||||
newsk->sk_wq = NULL;
|
||||
|
||||
if (mem_cgroup_sockets_enabled && sk->sk_memcg)
|
||||
sock_update_memcg(newsk);
|
||||
|
||||
if (newsk->sk_prot->sockets_allocated)
|
||||
sk_sockets_allocated_inc(newsk);
|
||||
|
||||
|
@@ -424,8 +424,6 @@ void tcp_init_sock(struct sock *sk)
|
||||
sk->sk_rcvbuf = sysctl_tcp_rmem[1];
|
||||
|
||||
local_bh_disable();
|
||||
if (mem_cgroup_sockets_enabled)
|
||||
sock_update_memcg(sk);
|
||||
sk_sockets_allocated_inc(sk);
|
||||
local_bh_enable();
|
||||
}
|
||||
|
@@ -1871,9 +1871,6 @@ void tcp_v4_destroy_sock(struct sock *sk)
|
||||
local_bh_disable();
|
||||
sk_sockets_allocated_dec(sk);
|
||||
local_bh_enable();
|
||||
|
||||
if (mem_cgroup_sockets_enabled && sk->sk_memcg)
|
||||
sock_release_memcg(sk);
|
||||
}
|
||||
EXPORT_SYMBOL(tcp_v4_destroy_sock);
|
||||
|
||||
|
在新工单中引用
屏蔽一个用户