diff options
author | Glauber Costa <glommer@parallels.com> | 2011-12-11 16:47:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-12 19:04:10 -0500 |
commit | 180d8cd942ce336b2c869d324855c40c5db478ad (patch) | |
tree | 2424d854345d81464d6030ef8090a8e22bd414b0 /net/ipv4/tcp_ipv4.c | |
parent | e5671dfae59b165e2adfd4dfbdeab11ac8db5bda (diff) |
foundations of per-cgroup memory pressure controlling.
This patch replaces all uses of struct sock fields' memory_pressure,
memory_allocated, sockets_allocated, and sysctl_mem to acessor
macros. Those macros can either receive a socket argument, or a mem_cgroup
argument, depending on the context they live in.
Since we're only doing a macro wrapping here, no performance impact at all is
expected in the case where we don't have cgroups disabled.
Signed-off-by: Glauber Costa <glommer@parallels.com>
Reviewed-by: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>
CC: David S. Miller <davem@davemloft.net>
CC: Eric W. Biederman <ebiederm@xmission.com>
CC: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index c4b8b09db9f5..f48bf312cfe8 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1917,7 +1917,7 @@ static int tcp_v4_init_sock(struct sock *sk) | |||
1917 | sk->sk_rcvbuf = sysctl_tcp_rmem[1]; | 1917 | sk->sk_rcvbuf = sysctl_tcp_rmem[1]; |
1918 | 1918 | ||
1919 | local_bh_disable(); | 1919 | local_bh_disable(); |
1920 | percpu_counter_inc(&tcp_sockets_allocated); | 1920 | sk_sockets_allocated_inc(sk); |
1921 | local_bh_enable(); | 1921 | local_bh_enable(); |
1922 | 1922 | ||
1923 | return 0; | 1923 | return 0; |
@@ -1973,7 +1973,7 @@ void tcp_v4_destroy_sock(struct sock *sk) | |||
1973 | tp->cookie_values = NULL; | 1973 | tp->cookie_values = NULL; |
1974 | } | 1974 | } |
1975 | 1975 | ||
1976 | percpu_counter_dec(&tcp_sockets_allocated); | 1976 | sk_sockets_allocated_dec(sk); |
1977 | } | 1977 | } |
1978 | EXPORT_SYMBOL(tcp_v4_destroy_sock); | 1978 | EXPORT_SYMBOL(tcp_v4_destroy_sock); |
1979 | 1979 | ||