aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@redhat.com>2015-01-22 18:51:33 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-25 17:47:16 -0500
commit30cfe7c9c88d73440560d7e381bab12f5463a6cd (patch)
treeaeacfcc4082476e4e5f482030091926cef5035fb /net/ipv4
parent95f60ea3e99aef5967d1566979f4ade7be386e34 (diff)
fib_trie: Use empty_children instead of counting empty nodes in stats collection
It doesn't make much sense to count the pointers ourselves when empty_children already has a count for the number of NULL pointers stored in the tnode. As such save ourselves the cycles and just use empty_children. Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_trie.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index f874e1811eab..90654bb64e21 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1954,16 +1954,10 @@ static void trie_collect_stats(struct trie *t, struct trie_stat *s)
1954 hlist_for_each_entry_rcu(li, &n->list, hlist) 1954 hlist_for_each_entry_rcu(li, &n->list, hlist)
1955 ++s->prefixes; 1955 ++s->prefixes;
1956 } else { 1956 } else {
1957 unsigned long i;
1958
1959 s->tnodes++; 1957 s->tnodes++;
1960 if (n->bits < MAX_STAT_DEPTH) 1958 if (n->bits < MAX_STAT_DEPTH)
1961 s->nodesizes[n->bits]++; 1959 s->nodesizes[n->bits]++;
1962 1960 s->nullpointers += n->empty_children;
1963 for (i = tnode_child_length(n); i--;) {
1964 if (!rcu_access_pointer(n->child[i]))
1965 s->nullpointers++;
1966 }
1967 } 1961 }
1968 } 1962 }
1969 rcu_read_unlock(); 1963 rcu_read_unlock();