Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8e5105a0c36a059dfd0f0bb9e73ee7c97d306247
Commit:     8e5105a0c36a059dfd0f0bb9e73ee7c97d306247
Parent:     61eb3107cd8e0302f95aae26206e552365daf290
Author:     Patrick McHardy <[EMAIL PROTECTED]>
AuthorDate: Sat Jul 7 22:27:33 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Tue Jul 10 22:17:39 2007 -0700

    [NETFILTER]: nf_conntrack: round up hashsize to next multiple of PAGE_SIZE
    
    Don't let the rest of the page go to waste.
    
    Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/netfilter/nf_conntrack_core.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index 035eb9f..54acac5 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -965,12 +965,14 @@ void nf_conntrack_cleanup(void)
        nf_conntrack_helper_fini();
 }
 
-static struct list_head *alloc_hashtable(int size, int *vmalloced)
+static struct list_head *alloc_hashtable(int *sizep, int *vmalloced)
 {
        struct list_head *hash;
-       unsigned int i;
+       unsigned int size, i;
 
        *vmalloced = 0;
+
+       size = *sizep = roundup(*sizep, PAGE_SIZE / sizeof(struct list_head));
        hash = (void*)__get_free_pages(GFP_KERNEL,
                                       get_order(sizeof(struct list_head)
                                                 * size));
@@ -1003,7 +1005,7 @@ int set_hashsize(const char *val, struct kernel_param *kp)
        if (!hashsize)
                return -EINVAL;
 
-       hash = alloc_hashtable(hashsize, &vmalloced);
+       hash = alloc_hashtable(&hashsize, &vmalloced);
        if (!hash)
                return -ENOMEM;
 
@@ -1053,19 +1055,19 @@ int __init nf_conntrack_init(void)
                if (nf_conntrack_htable_size < 16)
                        nf_conntrack_htable_size = 16;
        }
-       nf_conntrack_max = 8 * nf_conntrack_htable_size;
-
-       printk("nf_conntrack version %s (%u buckets, %d max)\n",
-              NF_CONNTRACK_VERSION, nf_conntrack_htable_size,
-              nf_conntrack_max);
-
-       nf_conntrack_hash = alloc_hashtable(nf_conntrack_htable_size,
+       nf_conntrack_hash = alloc_hashtable(&nf_conntrack_htable_size,
                                            &nf_conntrack_vmalloc);
        if (!nf_conntrack_hash) {
                printk(KERN_ERR "Unable to create nf_conntrack_hash\n");
                goto err_out;
        }
 
+       nf_conntrack_max = 8 * nf_conntrack_htable_size;
+
+       printk("nf_conntrack version %s (%u buckets, %d max)\n",
+              NF_CONNTRACK_VERSION, nf_conntrack_htable_size,
+              nf_conntrack_max);
+
        nf_conntrack_cachep = kmem_cache_create("nf_conntrack",
                                                sizeof(struct nf_conn),
                                                0, 0, NULL, NULL);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to