netfilter ip_conntrack num_physpages

From: Hugh Dickins (hugh@veritas.com)
Date: Mon Mar 05 2001 - 10:55:26 EST


num_physpages is shifted too far in netfilter's ip_conntrack_init():
would go to 0 on a 4GB, 8GB, ... 32-bit machine. Okay, not quite all
the 4GB goes into num_physpages, so it's rather an issue with 5GB ...

Naive patch (against 2.4.3-pre2 or 2.4.2-ac11 or 2.4.2 or 2.4.1) below,
but I won't be submitting this to Alan or Linus myself (unless you ask):
I expect you'll want to consider whether the number should go on
climbing linearly in that way above 1GB.

Hugh

--- 2.4.2-ac11/net/ipv4/netfilter/ip_conntrack_core.c Mon Mar 5 11:47:01 2001
+++ linux/net/ipv4/netfilter/ip_conntrack_core.c Mon Mar 5 12:01:49 2001
@@ -1078,7 +1078,7 @@
         /* Idea from tcp.c: use 1/16384 of memory. On i386: 32MB
          * machine has 256 buckets. 1GB machine has 8192 buckets. */
         ip_conntrack_htable_size
- = (((num_physpages << PAGE_SHIFT) / 16384)
+ = (((num_physpages << (PAGE_SHIFT - 12)) / 4)
                    / sizeof(struct list_head));
         ip_conntrack_max = 8 * ip_conntrack_htable_size;
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Mar 07 2001 - 21:00:17 EST