aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index be4b161802e8..8e8529d3c8c9 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -288,9 +288,11 @@ int sysctl_tcp_min_tso_segs __read_mostly = 2;
288struct percpu_counter tcp_orphan_count; 288struct percpu_counter tcp_orphan_count;
289EXPORT_SYMBOL_GPL(tcp_orphan_count); 289EXPORT_SYMBOL_GPL(tcp_orphan_count);
290 290
291long sysctl_tcp_mem[3] __read_mostly;
291int sysctl_tcp_wmem[3] __read_mostly; 292int sysctl_tcp_wmem[3] __read_mostly;
292int sysctl_tcp_rmem[3] __read_mostly; 293int sysctl_tcp_rmem[3] __read_mostly;
293 294
295EXPORT_SYMBOL(sysctl_tcp_mem);
294EXPORT_SYMBOL(sysctl_tcp_rmem); 296EXPORT_SYMBOL(sysctl_tcp_rmem);
295EXPORT_SYMBOL(sysctl_tcp_wmem); 297EXPORT_SYMBOL(sysctl_tcp_wmem);
296 298
@@ -3097,13 +3099,13 @@ static int __init set_thash_entries(char *str)
3097} 3099}
3098__setup("thash_entries=", set_thash_entries); 3100__setup("thash_entries=", set_thash_entries);
3099 3101
3100void tcp_init_mem(struct net *net) 3102static void tcp_init_mem(void)
3101{ 3103{
3102 unsigned long limit = nr_free_buffer_pages() / 8; 3104 unsigned long limit = nr_free_buffer_pages() / 8;
3103 limit = max(limit, 128UL); 3105 limit = max(limit, 128UL);
3104 net->ipv4.sysctl_tcp_mem[0] = limit / 4 * 3; 3106 sysctl_tcp_mem[0] = limit / 4 * 3;
3105 net->ipv4.sysctl_tcp_mem[1] = limit; 3107 sysctl_tcp_mem[1] = limit;
3106 net->ipv4.sysctl_tcp_mem[2] = net->ipv4.sysctl_tcp_mem[0] * 2; 3108 sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2;
3107} 3109}
3108 3110
3109void __init tcp_init(void) 3111void __init tcp_init(void)
@@ -3165,7 +3167,7 @@ void __init tcp_init(void)
3165 sysctl_tcp_max_orphans = cnt / 2; 3167 sysctl_tcp_max_orphans = cnt / 2;
3166 sysctl_max_syn_backlog = max(128, cnt / 256); 3168 sysctl_max_syn_backlog = max(128, cnt / 256);
3167 3169
3168 tcp_init_mem(&init_net); 3170 tcp_init_mem();
3169 /* Set per-socket limits to no more than 1/128 the pressure threshold */ 3171 /* Set per-socket limits to no more than 1/128 the pressure threshold */
3170 limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7); 3172 limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7);
3171 max_wshare = min(4UL*1024*1024, limit); 3173 max_wshare = min(4UL*1024*1024, limit);