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.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 19ea5c0b094b..87f68e787d0c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -257,6 +257,7 @@
257#include <linux/fs.h> 257#include <linux/fs.h>
258#include <linux/random.h> 258#include <linux/random.h>
259#include <linux/bootmem.h> 259#include <linux/bootmem.h>
260#include <linux/cache.h>
260 261
261#include <net/icmp.h> 262#include <net/icmp.h>
262#include <net/tcp.h> 263#include <net/tcp.h>
@@ -275,9 +276,9 @@ atomic_t tcp_orphan_count = ATOMIC_INIT(0);
275 276
276EXPORT_SYMBOL_GPL(tcp_orphan_count); 277EXPORT_SYMBOL_GPL(tcp_orphan_count);
277 278
278int sysctl_tcp_mem[3]; 279int sysctl_tcp_mem[3] __read_mostly;
279int sysctl_tcp_wmem[3] = { 4 * 1024, 16 * 1024, 128 * 1024 }; 280int sysctl_tcp_wmem[3] __read_mostly;
280int sysctl_tcp_rmem[3] = { 4 * 1024, 87380, 87380 * 2 }; 281int sysctl_tcp_rmem[3] __read_mostly;
281 282
282EXPORT_SYMBOL(sysctl_tcp_mem); 283EXPORT_SYMBOL(sysctl_tcp_mem);
283EXPORT_SYMBOL(sysctl_tcp_rmem); 284EXPORT_SYMBOL(sysctl_tcp_rmem);
@@ -2081,7 +2082,8 @@ __setup("thash_entries=", set_thash_entries);
2081void __init tcp_init(void) 2082void __init tcp_init(void)
2082{ 2083{
2083 struct sk_buff *skb = NULL; 2084 struct sk_buff *skb = NULL;
2084 int order, i; 2085 unsigned long limit;
2086 int order, i, max_share;
2085 2087
2086 if (sizeof(struct tcp_skb_cb) > sizeof(skb->cb)) 2088 if (sizeof(struct tcp_skb_cb) > sizeof(skb->cb))
2087 __skb_cb_too_small_for_tcp(sizeof(struct tcp_skb_cb), 2089 __skb_cb_too_small_for_tcp(sizeof(struct tcp_skb_cb),
@@ -2155,12 +2157,16 @@ void __init tcp_init(void)
2155 sysctl_tcp_mem[1] = 1024 << order; 2157 sysctl_tcp_mem[1] = 1024 << order;
2156 sysctl_tcp_mem[2] = 1536 << order; 2158 sysctl_tcp_mem[2] = 1536 << order;
2157 2159
2158 if (order < 3) { 2160 limit = ((unsigned long)sysctl_tcp_mem[1]) << (PAGE_SHIFT - 7);
2159 sysctl_tcp_wmem[2] = 64 * 1024; 2161 max_share = min(4UL*1024*1024, limit);
2160 sysctl_tcp_rmem[0] = PAGE_SIZE; 2162
2161 sysctl_tcp_rmem[1] = 43689; 2163 sysctl_tcp_wmem[0] = SK_STREAM_MEM_QUANTUM;
2162 sysctl_tcp_rmem[2] = 2 * 43689; 2164 sysctl_tcp_wmem[1] = 16*1024;
2163 } 2165 sysctl_tcp_wmem[2] = max(64*1024, max_share);
2166
2167 sysctl_tcp_rmem[0] = SK_STREAM_MEM_QUANTUM;
2168 sysctl_tcp_rmem[1] = 87380;
2169 sysctl_tcp_rmem[2] = max(87380, max_share);
2164 2170
2165 printk(KERN_INFO "TCP: Hash tables configured " 2171 printk(KERN_INFO "TCP: Hash tables configured "
2166 "(established %d bind %d)\n", 2172 "(established %d bind %d)\n",