* [PATCH 1/2] ipv4: fib_trie remove unused argument
@ 2008-04-03 4:57 Stephen Hemminger
2008-04-03 4:58 ` [PATCH 2/2] ipv4: fib_trie leaf free optimization Stephen Hemminger
2008-04-10 10:46 ` [PATCH 1/2] ipv4: fib_trie remove unused argument David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Stephen Hemminger @ 2008-04-03 4:57 UTC (permalink / raw)
To: David Miller; +Cc: netdev
The trie pointer is passed down to flush_list and flush_leaf
but never used.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/net/ipv4/fib_trie.c 2008-04-02 10:55:44.000000000 -0700
+++ b/net/ipv4/fib_trie.c 2008-04-02 11:01:04.000000000 -0700
@@ -1665,7 +1665,7 @@ static int fn_trie_delete(struct fib_tab
return 0;
}
-static int trie_flush_list(struct trie *t, struct list_head *head)
+static int trie_flush_list(struct list_head *head)
{
struct fib_alias *fa, *fa_node;
int found = 0;
@@ -1683,7 +1683,7 @@ static int trie_flush_list(struct trie *
return found;
}
-static int trie_flush_leaf(struct trie *t, struct leaf *l)
+static int trie_flush_leaf(struct leaf *l)
{
int found = 0;
struct hlist_head *lih = &l->list;
@@ -1691,7 +1691,7 @@ static int trie_flush_leaf(struct trie *
struct leaf_info *li = NULL;
hlist_for_each_entry_safe(li, node, tmp, lih, hlist) {
- found += trie_flush_list(t, &li->falh);
+ found += trie_flush_list(&li->falh);
if (list_empty(&li->falh)) {
hlist_del_rcu(&li->hlist);
@@ -1782,7 +1782,7 @@ static int fn_trie_flush(struct fib_tabl
int found = 0;
for (l = trie_firstleaf(t); l; l = trie_nextleaf(l)) {
- found += trie_flush_leaf(t, l);
+ found += trie_flush_leaf(l);
if (ll && hlist_empty(&ll->list))
trie_leaf_remove(t, ll);
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] ipv4: fib_trie leaf free optimization
2008-04-03 4:57 [PATCH 1/2] ipv4: fib_trie remove unused argument Stephen Hemminger
@ 2008-04-03 4:58 ` Stephen Hemminger
2008-04-10 10:47 ` David Miller
2008-04-10 10:46 ` [PATCH 1/2] ipv4: fib_trie remove unused argument David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2008-04-03 4:58 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Avoid unneeded test in the case where object to be freed
has to be a leaf. Don't need to use the generic tnode_free()
function, instead just setup leaf to be freed.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/net/ipv4/fib_trie.c 2008-04-02 10:50:42.000000000 -0700
+++ b/net/ipv4/fib_trie.c 2008-04-02 10:50:43.000000000 -0700
@@ -160,7 +160,6 @@ static void tnode_put_child_reorg(struct
static struct node *resize(struct trie *t, struct tnode *tn);
static struct tnode *inflate(struct trie *t, struct tnode *tn);
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;
@@ -334,6 +333,11 @@ static void __leaf_free_rcu(struct rcu_h
kmem_cache_free(trie_leaf_kmem, l);
}
+static inline void free_leaf(struct leaf *l)
+{
+ call_rcu_bh(&l->rcu, __leaf_free_rcu);
+}
+
static void __leaf_info_free_rcu(struct rcu_head *head)
{
kfree(container_of(head, struct leaf_info, rcu));
@@ -372,10 +376,9 @@ static void __tnode_free_rcu(struct rcu_
static inline void tnode_free(struct tnode *tn)
{
- if (IS_LEAF(tn)) {
- struct leaf *l = (struct leaf *) tn;
- call_rcu_bh(&l->rcu, __leaf_free_rcu);
- } else
+ if (IS_LEAF(tn))
+ free_leaf((struct leaf *) tn);
+ else
call_rcu(&tn->rcu, __tnode_free_rcu);
}
@@ -1086,7 +1089,7 @@ static struct list_head *fib_insert_node
li = leaf_info_new(plen);
if (!li) {
- tnode_free((struct tnode *) l);
+ free_leaf(l);
return NULL;
}
@@ -1122,7 +1125,7 @@ static struct list_head *fib_insert_node
if (!tn) {
free_leaf_info(li);
- tnode_free((struct tnode *) l);
+ free_leaf(l);
return NULL;
}
@@ -1578,7 +1581,7 @@ static void trie_leaf_remove(struct trie
} else
rcu_assign_pointer(t->trie, NULL);
- tnode_free((struct tnode *) l);
+ free_leaf(l);
}
/*
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ipv4: fib_trie remove unused argument
2008-04-03 4:57 [PATCH 1/2] ipv4: fib_trie remove unused argument Stephen Hemminger
2008-04-03 4:58 ` [PATCH 2/2] ipv4: fib_trie leaf free optimization Stephen Hemminger
@ 2008-04-10 10:46 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2008-04-10 10:46 UTC (permalink / raw)
To: shemminger; +Cc: netdev
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 2 Apr 2008 21:57:24 -0700
> The trie pointer is passed down to flush_list and flush_leaf
> but never used.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ipv4: fib_trie leaf free optimization
2008-04-03 4:58 ` [PATCH 2/2] ipv4: fib_trie leaf free optimization Stephen Hemminger
@ 2008-04-10 10:47 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2008-04-10 10:47 UTC (permalink / raw)
To: shemminger; +Cc: netdev
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 2 Apr 2008 21:58:59 -0700
> Avoid unneeded test in the case where object to be freed
> has to be a leaf. Don't need to use the generic tnode_free()
> function, instead just setup leaf to be freed.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-10 10:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-03 4:57 [PATCH 1/2] ipv4: fib_trie remove unused argument Stephen Hemminger
2008-04-03 4:58 ` [PATCH 2/2] ipv4: fib_trie leaf free optimization Stephen Hemminger
2008-04-10 10:47 ` David Miller
2008-04-10 10:46 ` [PATCH 1/2] ipv4: fib_trie remove unused argument David Miller
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).