rpcd: iwinfo plugin fixes
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-3.18 / 080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch
1 From: Alexander Duyck <alexander.h.duyck@redhat.com>
2 Date: Thu, 22 Jan 2015 15:51:33 -0800
3 Subject: [PATCH] fib_trie: Use empty_children instead of counting empty nodes
4 in stats collection
5
6 It doesn't make much sense to count the pointers ourselves when
7 empty_children already has a count for the number of NULL pointers stored
8 in the tnode. As such save ourselves the cycles and just use
9 empty_children.
10
11 Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14
15 --- a/net/ipv4/fib_trie.c
16 +++ b/net/ipv4/fib_trie.c
17 @@ -1954,16 +1954,10 @@ static void trie_collect_stats(struct tr
18 hlist_for_each_entry_rcu(li, &n->list, hlist)
19 ++s->prefixes;
20 } else {
21 - unsigned long i;
22 -
23 s->tnodes++;
24 if (n->bits < MAX_STAT_DEPTH)
25 s->nodesizes[n->bits]++;
26 -
27 - for (i = tnode_child_length(n); i--;) {
28 - if (!rcu_access_pointer(n->child[i]))
29 - s->nullpointers++;
30 - }
31 + s->nullpointers += n->empty_children;
32 }
33 }
34 rcu_read_unlock();