diff options
author | Glauber Costa <glommer@parallels.com> | 2011-12-11 16:47:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-12 19:04:11 -0500 |
commit | 3dc43e3e4d0b52197d3205214fe8f162f9e0c334 (patch) | |
tree | 1770affeb483a6b4f06cde9f2a2f1289b41496d6 /net/ipv4/tcp_memcontrol.c | |
parent | d1a4c0b37c296e600ffe08edb0db2dc1b8f550d7 (diff) |
per-netns ipv4 sysctl_tcp_mem
This patch allows each namespace to independently set up
its levels for tcp memory pressure thresholds. This patch
alone does not buy much: we need to make this values
per group of process somehow. This is achieved in the
patches that follows in this patchset.
Signed-off-by: Glauber Costa <glommer@parallels.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
CC: David S. Miller <davem@davemloft.net>
CC: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_memcontrol.c')
-rw-r--r-- | net/ipv4/tcp_memcontrol.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c index 4a68d2c24556..bfb0c2b8df46 100644 --- a/net/ipv4/tcp_memcontrol.c +++ b/net/ipv4/tcp_memcontrol.c | |||
@@ -1,6 +1,8 @@ | |||
1 | #include <net/tcp.h> | 1 | #include <net/tcp.h> |
2 | #include <net/tcp_memcontrol.h> | 2 | #include <net/tcp_memcontrol.h> |
3 | #include <net/sock.h> | 3 | #include <net/sock.h> |
4 | #include <net/ip.h> | ||
5 | #include <linux/nsproxy.h> | ||
4 | #include <linux/memcontrol.h> | 6 | #include <linux/memcontrol.h> |
5 | #include <linux/module.h> | 7 | #include <linux/module.h> |
6 | 8 | ||
@@ -28,6 +30,7 @@ int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss) | |||
28 | struct tcp_memcontrol *tcp; | 30 | struct tcp_memcontrol *tcp; |
29 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); | 31 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); |
30 | struct mem_cgroup *parent = parent_mem_cgroup(memcg); | 32 | struct mem_cgroup *parent = parent_mem_cgroup(memcg); |
33 | struct net *net = current->nsproxy->net_ns; | ||
31 | 34 | ||
32 | cg_proto = tcp_prot.proto_cgroup(memcg); | 35 | cg_proto = tcp_prot.proto_cgroup(memcg); |
33 | if (!cg_proto) | 36 | if (!cg_proto) |
@@ -35,9 +38,9 @@ int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss) | |||
35 | 38 | ||
36 | tcp = tcp_from_cgproto(cg_proto); | 39 | tcp = tcp_from_cgproto(cg_proto); |
37 | 40 | ||
38 | tcp->tcp_prot_mem[0] = sysctl_tcp_mem[0]; | 41 | tcp->tcp_prot_mem[0] = net->ipv4.sysctl_tcp_mem[0]; |
39 | tcp->tcp_prot_mem[1] = sysctl_tcp_mem[1]; | 42 | tcp->tcp_prot_mem[1] = net->ipv4.sysctl_tcp_mem[1]; |
40 | tcp->tcp_prot_mem[2] = sysctl_tcp_mem[2]; | 43 | tcp->tcp_prot_mem[2] = net->ipv4.sysctl_tcp_mem[2]; |
41 | tcp->tcp_memory_pressure = 0; | 44 | tcp->tcp_memory_pressure = 0; |
42 | 45 | ||
43 | parent_cg = tcp_prot.proto_cgroup(parent); | 46 | parent_cg = tcp_prot.proto_cgroup(parent); |