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>
This commit is contained in:
committed by
David S. Miller
parent
d1a4c0b37c
commit
3dc43e3e4d
@@ -282,11 +282,9 @@ int sysctl_tcp_fin_timeout __read_mostly = TCP_FIN_TIMEOUT;
|
||||
struct percpu_counter tcp_orphan_count;
|
||||
EXPORT_SYMBOL_GPL(tcp_orphan_count);
|
||||
|
||||
long sysctl_tcp_mem[3] __read_mostly;
|
||||
int sysctl_tcp_wmem[3] __read_mostly;
|
||||
int sysctl_tcp_rmem[3] __read_mostly;
|
||||
|
||||
EXPORT_SYMBOL(sysctl_tcp_mem);
|
||||
EXPORT_SYMBOL(sysctl_tcp_rmem);
|
||||
EXPORT_SYMBOL(sysctl_tcp_wmem);
|
||||
|
||||
@@ -3278,14 +3276,9 @@ void __init tcp_init(void)
|
||||
sysctl_tcp_max_orphans = cnt / 2;
|
||||
sysctl_max_syn_backlog = max(128, cnt / 256);
|
||||
|
||||
limit = nr_free_buffer_pages() / 8;
|
||||
limit = max(limit, 128UL);
|
||||
sysctl_tcp_mem[0] = limit / 4 * 3;
|
||||
sysctl_tcp_mem[1] = limit;
|
||||
sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2;
|
||||
|
||||
/* Set per-socket limits to no more than 1/128 the pressure threshold */
|
||||
limit = ((unsigned long)sysctl_tcp_mem[1]) << (PAGE_SHIFT - 7);
|
||||
limit = ((unsigned long)init_net.ipv4.sysctl_tcp_mem[1])
|
||||
<< (PAGE_SHIFT - 7);
|
||||
max_share = min(4UL*1024*1024, limit);
|
||||
|
||||
sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
|
||||
|
Reference in New Issue
Block a user