Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bc3c8c1e02ae89668239742fd592f21e1998fa46
Commit:     bc3c8c1e02ae89668239742fd592f21e1998fa46
Parent:     a1f6f5a7689098f01d9b7b7181795ee78563ce37
Author:     Stephen Hemminger <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 22 21:51:50 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 15:10:56 2008 -0800

    [IPV4] fib_trie: put leaf nodes in a slab cache
    
    This improves locality for operations that touch all the leaves.  Save
    space since these entries don't need to be hardware cache aligned.
    
    Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/fib_trie.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index a52334d..9291e7c 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -162,6 +162,7 @@ static struct tnode *halve(struct trie *t, struct tnode 
*tn);
 static void tnode_free(struct tnode *tn);
 
 static struct kmem_cache *fn_alias_kmem __read_mostly;
+static struct kmem_cache *trie_leaf_kmem __read_mostly;
 
 static inline struct tnode *node_parent(struct node *node)
 {
@@ -325,7 +326,8 @@ static inline void alias_free_mem_rcu(struct fib_alias *fa)
 
 static void __leaf_free_rcu(struct rcu_head *head)
 {
-       kfree(container_of(head, struct leaf, rcu));
+       struct leaf *l = container_of(head, struct leaf, rcu);
+       kmem_cache_free(trie_leaf_kmem, l);
 }
 
 static void __leaf_info_free_rcu(struct rcu_head *head)
@@ -375,7 +377,7 @@ static inline void tnode_free(struct tnode *tn)
 
 static struct leaf *leaf_new(void)
 {
-       struct leaf *l = kmalloc(sizeof(struct leaf),  GFP_KERNEL);
+       struct leaf *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
        if (l) {
                l->parent = T_LEAF;
                INIT_HLIST_HEAD(&l->list);
@@ -1938,7 +1940,12 @@ out:
 void __init fib_hash_init(void)
 {
        fn_alias_kmem = kmem_cache_create("ip_fib_alias", sizeof(struct 
fib_alias),
-                                         0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, 
NULL);
+                                         0, SLAB_PANIC, NULL);
+
+       trie_leaf_kmem = kmem_cache_create("ip_fib_trie",
+                                          max(sizeof(struct leaf),
+                                              sizeof(struct leaf_info)),
+                                          0, SLAB_PANIC, 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