tcp memory pressure controls
This patch introduces memory pressure controls for the tcp protocol. It uses the generic socket memory pressure code introduced in earlier patches, and fills in the necessary data in cg_proto struct. Signed-off-by: Glauber Costa <glommer@parallels.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtisu.com> CC: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
e1aab161e0
commit
d1a4c0b37c
@@ -73,6 +73,7 @@
|
||||
#include <net/xfrm.h>
|
||||
#include <net/netdma.h>
|
||||
#include <net/secure_seq.h>
|
||||
#include <net/tcp_memcontrol.h>
|
||||
|
||||
#include <linux/inet.h>
|
||||
#include <linux/ipv6.h>
|
||||
@@ -1917,6 +1918,7 @@ static int tcp_v4_init_sock(struct sock *sk)
|
||||
sk->sk_rcvbuf = sysctl_tcp_rmem[1];
|
||||
|
||||
local_bh_disable();
|
||||
sock_update_memcg(sk);
|
||||
sk_sockets_allocated_inc(sk);
|
||||
local_bh_enable();
|
||||
|
||||
@@ -1974,6 +1976,7 @@ void tcp_v4_destroy_sock(struct sock *sk)
|
||||
}
|
||||
|
||||
sk_sockets_allocated_dec(sk);
|
||||
sock_release_memcg(sk);
|
||||
}
|
||||
EXPORT_SYMBOL(tcp_v4_destroy_sock);
|
||||
|
||||
@@ -2634,10 +2637,14 @@ struct proto tcp_prot = {
|
||||
.compat_setsockopt = compat_tcp_setsockopt,
|
||||
.compat_getsockopt = compat_tcp_getsockopt,
|
||||
#endif
|
||||
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
|
||||
.init_cgroup = tcp_init_cgroup,
|
||||
.destroy_cgroup = tcp_destroy_cgroup,
|
||||
.proto_cgroup = tcp_proto_cgroup,
|
||||
#endif
|
||||
};
|
||||
EXPORT_SYMBOL(tcp_prot);
|
||||
|
||||
|
||||
static int __net_init tcp_sk_init(struct net *net)
|
||||
{
|
||||
return inet_ctl_sock_create(&net->ipv4.tcp_sock,
|
||||
|
Reference in New Issue
Block a user