aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-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 fc54a48fde1e..850825dc86e6 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -260,6 +260,8 @@
260#include <linux/socket.h> 260#include <linux/socket.h>
261#include <linux/random.h> 261#include <linux/random.h>
262#include <linux/bootmem.h> 262#include <linux/bootmem.h>
263#include <linux/highmem.h>
264#include <linux/swap.h>
263#include <linux/cache.h> 265#include <linux/cache.h>
264#include <linux/err.h> 266#include <linux/err.h>
265#include <linux/crypto.h> 267#include <linux/crypto.h>
@@ -2620,7 +2622,7 @@ __setup("thash_entries=", set_thash_entries);
2620void __init tcp_init(void) 2622void __init tcp_init(void)
2621{ 2623{
2622 struct sk_buff *skb = NULL; 2624 struct sk_buff *skb = NULL;
2623 unsigned long limit; 2625 unsigned long nr_pages, limit;
2624 int order, i, max_share; 2626 int order, i, max_share;
2625 2627
2626 BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); 2628 BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb));
@@ -2689,8 +2691,9 @@ void __init tcp_init(void)
2689 * is up to 1/2 at 256 MB, decreasing toward zero with the amount of 2691 * is up to 1/2 at 256 MB, decreasing toward zero with the amount of
2690 * memory, with a floor of 128 pages. 2692 * memory, with a floor of 128 pages.
2691 */ 2693 */
2692 limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); 2694 nr_pages = totalram_pages - totalhigh_pages;
2693 limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); 2695 limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
2696 limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
2694 limit = max(limit, 128UL); 2697 limit = max(limit, 128UL);
2695 sysctl_tcp_mem[0] = limit / 4 * 3; 2698 sysctl_tcp_mem[0] = limit / 4 * 3;
2696 sysctl_tcp_mem[1] = limit; 2699 sysctl_tcp_mem[1] = limit;