From 873d04c1ae9939850fe0a0efd6ec318c088270f1 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 29 Oct 2008 02:32:32 -0700 Subject: [PATCH] --- yaml --- r: 121525 b: refs/heads/master c: 8203efb3c612743fecb1ed67cf1daf9d9c127462 h: refs/heads/master i: 121523: 78c7a7c5b13ebd25bba3a09286f12179f3406c07 v: v3 --- [refs] | 2 +- trunk/net/ipv4/udp.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index a22edd5e01e5..e5a5891ec341 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 271b72c7fa82c2c7a795bc16896149933110672d +refs/heads/master: 8203efb3c612743fecb1ed67cf1daf9d9c127462 diff --git a/trunk/net/ipv4/udp.c b/trunk/net/ipv4/udp.c index 0ea974bf7962..5ba03401b914 100644 --- a/trunk/net/ipv4/udp.c +++ b/trunk/net/ipv4/udp.c @@ -81,6 +81,8 @@ #include #include #include +#include +#include #include #include #include @@ -1751,15 +1753,16 @@ void __init udp_table_init(struct udp_table *table) void __init udp_init(void) { - unsigned long limit; + unsigned long nr_pages, limit; udp_table_init(&udp_table); /* Set the pressure threshold up by the same strategy of TCP. It is a * fraction of global memory that is up to 1/2 at 256 MB, decreasing * toward zero with the amount of memory, with a floor of 128 pages. */ - limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); - limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); + nr_pages = totalram_pages - totalhigh_pages; + limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); + limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); limit = max(limit, 128UL); sysctl_udp_mem[0] = limit / 4 * 3; sysctl_udp_mem[1] = limit;