]> git.baikalelectronics.ru Git - kernel.git/commit
ipv4: Call fib_select_default() only when actually necessary.
authorDavid S. Miller <davem@davemloft.net>
Thu, 14 Apr 2011 21:49:37 +0000 (14:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 14 Apr 2011 22:05:22 +0000 (15:05 -0700)
commit049bfbfa14e5d6e8989800b3cbb7fb0b1e833261
tree03e19c4f6f24fd67da407463508c0ee27f6f9785
parent27bb22822c8d45ab394ce06080002b457ca601d8
ipv4: Call fib_select_default() only when actually necessary.

fib_select_default() is a complete NOP, and completely pointless
to invoke, when we have no more than 1 default route installed.

And this is far and away the common case.

So remember how many prefixlen==0 routes we have in the routing
table, and elide the call when we have no more than one of those.

This cuts output route creation time by 157 cycles on Niagara2+.

In order to add the new int to fib_table, we have to correct the type
of ->tb_data[] to unsigned long, otherwise the private area will be
unaligned on 64-bit systems.

Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
include/net/ip_fib.h
net/ipv4/fib_trie.c
net/ipv4/route.c