On Tue, 15 Jan 2008 10:15:43 -0800 Stephen Hemminger <[EMAIL PROTECTED]> wrote:
> On Tue, 15 Jan 2008 19:10:31 +0100 > Eric Dumazet <[EMAIL PROTECTED]> wrote: > > > On Tue, 15 Jan 2008 09:47:53 -0800 > > Stephen Hemminger <[EMAIL PROTECTED]> wrote: > > > > > This is how I did it: > > > > > > --- a/net/ipv4/fib_trie.c 2008-01-15 09:14:53.000000000 -0800 > > > +++ b/net/ipv4/fib_trie.c 2008-01-15 09:21:48.000000000 -0800 > > > @@ -101,13 +101,6 @@ struct node { > > > t_key key; > > > }; > > > > > > -struct leaf { > > > - unsigned long parent; > > > - t_key key; > > > - struct hlist_head list; > > > - struct rcu_head rcu; > > > -}; > > > - > > > struct leaf_info { > > > struct hlist_node hlist; > > > struct rcu_head rcu; > > > @@ -115,6 +108,13 @@ struct leaf_info { > > > struct list_head falh; > > > }; > > > > > > +struct leaf { > > > + unsigned long parent; > > > + t_key key; > > > + struct hlist_head list; > > > + struct rcu_head rcu; > > > +}; > > > > I like this :) > > > > Your design is clean, but we waste some space (rcu in leaf_info > > "included"), we probably can do a litle bit better > > (moving rcu at the end of leaf_info, and kmem_cache_create("ip_fib_trie", > > sizeof(struct leaf) + sizeof(struct_leaf_info) - sizeof(struct rcu_head)) > > > > > > > - trie_leaf_kmem = kmem_cache_create("ip_fib_trie", sizeof(struct leaf), > > > + trie_leaf_kmem = kmem_cache_create("ip_fib_trie", > > > + sizeof(struct leaf) + sizeof(struct > > > leaf_info), > > > 0, SLAB_PANIC, NULL); > > > } > > > > > > > > > > Thank you > > Having multiple RCU links is a waste. I started on code that just splice's the > leaf_info's off to a free_list and then do a mass free after and RCU barrier. > > For the normal case of just freeing a leaf, it could just walk the chain > in the RCU free of the leaf. Well, If you take this path, we can also copy the leaf itself, and just use a variable size array of infos[], no more list, and maximal locality kmalloc(sizeof(leaf) + nb_infos * sizeof(info)) (Still we can use a kmem cache for nb_infos=1 leaves) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html