aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorGlauber Costa <glommer@parallels.com>2011-12-11 16:47:05 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-12 19:04:11 -0500
commit3dc43e3e4d0b52197d3205214fe8f162f9e0c334 (patch)
tree1770affeb483a6b4f06cde9f2a2f1289b41496d6 /net/ipv4/tcp.c
parentd1a4c0b37c296e600ffe08edb0db2dc1b8f550d7 (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.c')
-rw-r--r--net/ipv4/tcp.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 43dfccce62e9..9bcdec3ad772 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -282,11 +282,9 @@ int sysctl_tcp_fin_timeout __read_mostly = TCP_FIN_TIMEOUT;
282struct percpu_counter tcp_orphan_count; 282struct percpu_counter tcp_orphan_count;
283EXPORT_SYMBOL_GPL(tcp_orphan_count); 283EXPORT_SYMBOL_GPL(tcp_orphan_count);
284 284
285long sysctl_tcp_mem[3] __read_mostly;
286int sysctl_tcp_wmem[3] __read_mostly; 285int sysctl_tcp_wmem[3] __read_mostly;
287int sysctl_tcp_rmem[3] __read_mostly; 286int sysctl_tcp_rmem[3] __read_mostly;
288 287
289EXPORT_SYMBOL(sysctl_tcp_mem);
290EXPORT_SYMBOL(sysctl_tcp_rmem); 288EXPORT_SYMBOL(sysctl_tcp_rmem);
291EXPORT_SYMBOL(sysctl_tcp_wmem); 289EXPORT_SYMBOL(sysctl_tcp_wmem);
292 290
@@ -3278,14 +3276,9 @@ void __init tcp_init(void)
3278 sysctl_tcp_max_orphans = cnt / 2; 3276 sysctl_tcp_max_orphans = cnt / 2;
3279 sysctl_max_syn_backlog = max(128, cnt / 256); 3277 sysctl_max_syn_backlog = max(128, cnt / 256);
3280 3278
3281 limit = nr_free_buffer_pages() / 8;
3282 limit = max(limit, 128UL);
3283 sysctl_tcp_mem[0] = limit / 4 * 3;
3284 sysctl_tcp_mem[1] = limit;
3285 sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2;
3286
3287 /* Set per-socket limits to no more than 1/128 the pressure threshold */ 3279 /* Set per-socket limits to no more than 1/128 the pressure threshold */
3288 limit = ((unsigned long)sysctl_tcp_mem[1]) << (PAGE_SHIFT - 7); 3280 limit = ((unsigned long)init_net.ipv4.sysctl_tcp_mem[1])
3281 << (PAGE_SHIFT - 7);
3289 max_share = min(4UL*1024*1024, limit); 3282 max_share = min(4UL*1024*1024, limit);
3290 3283
3291 sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; 3284 sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;