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.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index cf0850c068f5..c66ac83316e8 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -258,6 +258,8 @@
258#include <linux/socket.h> 258#include <linux/socket.h>
259#include <linux/random.h> 259#include <linux/random.h>
260#include <linux/bootmem.h> 260#include <linux/bootmem.h>
261#include <linux/highmem.h>
262#include <linux/swap.h>
261#include <linux/cache.h> 263#include <linux/cache.h>
262#include <linux/err.h> 264#include <linux/err.h>
263#include <linux/crypto.h> 265#include <linux/crypto.h>
@@ -2688,7 +2690,7 @@ __setup("thash_entries=", set_thash_entries);
2688void __init tcp_init(void) 2690void __init tcp_init(void)
2689{ 2691{
2690 struct sk_buff *skb = NULL; 2692 struct sk_buff *skb = NULL;
2691 unsigned long limit; 2693 unsigned long nr_pages, limit;
2692 int order, i, max_share; 2694 int order, i, max_share;
2693 2695
2694 BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); 2696 BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb));
@@ -2757,8 +2759,9 @@ void __init tcp_init(void)
2757 * is up to 1/2 at 256 MB, decreasing toward zero with the amount of 2759 * is up to 1/2 at 256 MB, decreasing toward zero with the amount of
2758 * memory, with a floor of 128 pages. 2760 * memory, with a floor of 128 pages.
2759 */ 2761 */
2760 limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); 2762 nr_pages = totalram_pages - totalhigh_pages;
2761 limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); 2763 limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
2764 limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
2762 limit = max(limit, 128UL); 2765 limit = max(limit, 128UL);
2763 sysctl_tcp_mem[0] = limit / 4 * 3; 2766 sysctl_tcp_mem[0] = limit / 4 * 3;
2764 sysctl_tcp_mem[1] = limit; 2767 sysctl_tcp_mem[1] = limit;