diff options
-rw-r--r-- | net/ipv4/udp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 0ea974bf7962..5ba03401b914 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -81,6 +81,8 @@ | |||
81 | #include <asm/uaccess.h> | 81 | #include <asm/uaccess.h> |
82 | #include <asm/ioctls.h> | 82 | #include <asm/ioctls.h> |
83 | #include <linux/bootmem.h> | 83 | #include <linux/bootmem.h> |
84 | #include <linux/highmem.h> | ||
85 | #include <linux/swap.h> | ||
84 | #include <linux/types.h> | 86 | #include <linux/types.h> |
85 | #include <linux/fcntl.h> | 87 | #include <linux/fcntl.h> |
86 | #include <linux/module.h> | 88 | #include <linux/module.h> |
@@ -1751,15 +1753,16 @@ void __init udp_table_init(struct udp_table *table) | |||
1751 | 1753 | ||
1752 | void __init udp_init(void) | 1754 | void __init udp_init(void) |
1753 | { | 1755 | { |
1754 | unsigned long limit; | 1756 | unsigned long nr_pages, limit; |
1755 | 1757 | ||
1756 | udp_table_init(&udp_table); | 1758 | udp_table_init(&udp_table); |
1757 | /* Set the pressure threshold up by the same strategy of TCP. It is a | 1759 | /* Set the pressure threshold up by the same strategy of TCP. It is a |
1758 | * fraction of global memory that is up to 1/2 at 256 MB, decreasing | 1760 | * fraction of global memory that is up to 1/2 at 256 MB, decreasing |
1759 | * toward zero with the amount of memory, with a floor of 128 pages. | 1761 | * toward zero with the amount of memory, with a floor of 128 pages. |
1760 | */ | 1762 | */ |
1761 | limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); | 1763 | nr_pages = totalram_pages - totalhigh_pages; |
1762 | limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); | 1764 | limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); |
1765 | limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); | ||
1763 | limit = max(limit, 128UL); | 1766 | limit = max(limit, 128UL); |
1764 | sysctl_udp_mem[0] = limit / 4 * 3; | 1767 | sysctl_udp_mem[0] = limit / 4 * 3; |
1765 | sysctl_udp_mem[1] = limit; | 1768 | sysctl_udp_mem[1] = limit; |