netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] use total_highpages when calculating lowmem-only allocation sizes (netlink)
@ 2010-12-06 16:43 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2010-12-06 16:43 UTC (permalink / raw)
  To: netdev; +Cc: akpm

For those (large) table allocations that come only from lowmem, the
total amount of memory shouldn't really matter.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

---
 net/netlink/af_netlink.c          |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- linux-2.6.37-rc4/net/netlink/af_netlink.c
+++ 2.6.37-rc4-use-totalhigh_pages/net/netlink/af_netlink.c
@@ -30,6 +30,7 @@
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/string.h>
+#include <linux/highmem.h>
 #include <linux/stat.h>
 #include <linux/socket.h>
 #include <linux/un.h>
@@ -2127,10 +2128,11 @@ static int __init netlink_proto_init(voi
 	if (!nl_table)
 		goto panic;
 
-	if (totalram_pages >= (128 * 1024))
-		limit = totalram_pages >> (21 - PAGE_SHIFT);
+	limit = totalram_pages - totalhigh_pages;
+	if (limit >= (128 * 1024))
+		limit >>= 21 - PAGE_SHIFT;
 	else
-		limit = totalram_pages >> (23 - PAGE_SHIFT);
+		limit >>= 23 - PAGE_SHIFT;
 
 	order = get_bitmask_order(limit) - 1 + PAGE_SHIFT;
 	limit = (1UL << order) / sizeof(struct hlist_head);




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-06 16:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-06 16:43 [PATCH] use total_highpages when calculating lowmem-only allocation sizes (netlink) Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).