aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a9db4b1a2215..1eb4ad57670e 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -73,6 +73,7 @@
73#include <net/xfrm.h> 73#include <net/xfrm.h>
74#include <net/netdma.h> 74#include <net/netdma.h>
75#include <net/secure_seq.h> 75#include <net/secure_seq.h>
76#include <net/tcp_memcontrol.h>
76 77
77#include <linux/inet.h> 78#include <linux/inet.h>
78#include <linux/ipv6.h> 79#include <linux/ipv6.h>
@@ -1511,6 +1512,7 @@ exit:
1511 return NULL; 1512 return NULL;
1512put_and_exit: 1513put_and_exit:
1513 tcp_clear_xmit_timers(newsk); 1514 tcp_clear_xmit_timers(newsk);
1515 tcp_cleanup_congestion_control(newsk);
1514 bh_unlock_sock(newsk); 1516 bh_unlock_sock(newsk);
1515 sock_put(newsk); 1517 sock_put(newsk);
1516 goto exit; 1518 goto exit;
@@ -1916,7 +1918,8 @@ static int tcp_v4_init_sock(struct sock *sk)
1916 sk->sk_rcvbuf = sysctl_tcp_rmem[1]; 1918 sk->sk_rcvbuf = sysctl_tcp_rmem[1];
1917 1919
1918 local_bh_disable(); 1920 local_bh_disable();
1919 percpu_counter_inc(&tcp_sockets_allocated); 1921 sock_update_memcg(sk);
1922 sk_sockets_allocated_inc(sk);
1920 local_bh_enable(); 1923 local_bh_enable();
1921 1924
1922 return 0; 1925 return 0;
@@ -1972,7 +1975,8 @@ void tcp_v4_destroy_sock(struct sock *sk)
1972 tp->cookie_values = NULL; 1975 tp->cookie_values = NULL;
1973 } 1976 }
1974 1977
1975 percpu_counter_dec(&tcp_sockets_allocated); 1978 sk_sockets_allocated_dec(sk);
1979 sock_release_memcg(sk);
1976} 1980}
1977EXPORT_SYMBOL(tcp_v4_destroy_sock); 1981EXPORT_SYMBOL(tcp_v4_destroy_sock);
1978 1982
@@ -2619,7 +2623,6 @@ struct proto tcp_prot = {
2619 .orphan_count = &tcp_orphan_count, 2623 .orphan_count = &tcp_orphan_count,
2620 .memory_allocated = &tcp_memory_allocated, 2624 .memory_allocated = &tcp_memory_allocated,
2621 .memory_pressure = &tcp_memory_pressure, 2625 .memory_pressure = &tcp_memory_pressure,
2622 .sysctl_mem = sysctl_tcp_mem,
2623 .sysctl_wmem = sysctl_tcp_wmem, 2626 .sysctl_wmem = sysctl_tcp_wmem,
2624 .sysctl_rmem = sysctl_tcp_rmem, 2627 .sysctl_rmem = sysctl_tcp_rmem,
2625 .max_header = MAX_TCP_HEADER, 2628 .max_header = MAX_TCP_HEADER,
@@ -2633,10 +2636,14 @@ struct proto tcp_prot = {
2633 .compat_setsockopt = compat_tcp_setsockopt, 2636 .compat_setsockopt = compat_tcp_setsockopt,
2634 .compat_getsockopt = compat_tcp_getsockopt, 2637 .compat_getsockopt = compat_tcp_getsockopt,
2635#endif 2638#endif
2639#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
2640 .init_cgroup = tcp_init_cgroup,
2641 .destroy_cgroup = tcp_destroy_cgroup,
2642 .proto_cgroup = tcp_proto_cgroup,
2643#endif
2636}; 2644};
2637EXPORT_SYMBOL(tcp_prot); 2645EXPORT_SYMBOL(tcp_prot);
2638 2646
2639
2640static int __net_init tcp_sk_init(struct net *net) 2647static int __net_init tcp_sk_init(struct net *net)
2641{ 2648{
2642 return inet_ctl_sock_create(&net->ipv4.tcp_sock, 2649 return inet_ctl_sock_create(&net->ipv4.tcp_sock,