alistair23-linux/net/ipv4
Eric Dumazet ebc0ffae5d fib: RCU conversion of fib_lookup()
fib_lookup() converted to be called in RCU protected context, no
reference taken and released on a contended cache line (fib_clntref)

fib_table_lookup() and fib_semantic_match() get an additional parameter.

struct fib_info gets an rcu_head field, and is freed after an rcu grace
period.

Stress test :
(Sending 160.000.000 UDP frames on same neighbour,
IP route cache disabled, dual E5540 @2.53GHz,
32bit kernel, FIB_HASH) (about same results for FIB_TRIE)

Before patch :

real	1m31.199s
user	0m13.761s
sys	23m24.780s

After patch:

real	1m5.375s
user	0m14.997s
sys	15m50.115s

Before patch Profile :

13044.00 15.4% __ip_route_output_key vmlinux
 8438.00 10.0% dst_destroy           vmlinux
 5983.00  7.1% fib_semantic_match    vmlinux
 5410.00  6.4% fib_rules_lookup      vmlinux
 4803.00  5.7% neigh_lookup          vmlinux
 4420.00  5.2% _raw_spin_lock        vmlinux
 3883.00  4.6% rt_set_nexthop        vmlinux
 3261.00  3.9% _raw_read_lock        vmlinux
 2794.00  3.3% fib_table_lookup      vmlinux
 2374.00  2.8% neigh_resolve_output  vmlinux
 2153.00  2.5% dst_alloc             vmlinux
 1502.00  1.8% _raw_read_lock_bh     vmlinux
 1484.00  1.8% kmem_cache_alloc      vmlinux
 1407.00  1.7% eth_header            vmlinux
 1406.00  1.7% ipv4_dst_destroy      vmlinux
 1298.00  1.5% __copy_from_user_ll   vmlinux
 1174.00  1.4% dev_queue_xmit        vmlinux
 1000.00  1.2% ip_output             vmlinux

After patch Profile :

13712.00 15.8% dst_destroy             vmlinux
 8548.00  9.9% __ip_route_output_key   vmlinux
 7017.00  8.1% neigh_lookup            vmlinux
 4554.00  5.3% fib_semantic_match      vmlinux
 4067.00  4.7% _raw_read_lock          vmlinux
 3491.00  4.0% dst_alloc               vmlinux
 3186.00  3.7% neigh_resolve_output    vmlinux
 3103.00  3.6% fib_table_lookup        vmlinux
 2098.00  2.4% _raw_read_lock_bh       vmlinux
 2081.00  2.4% kmem_cache_alloc        vmlinux
 2013.00  2.3% _raw_spin_lock          vmlinux
 1763.00  2.0% __copy_from_user_ll     vmlinux
 1763.00  2.0% ip_output               vmlinux
 1761.00  2.0% ipv4_dst_destroy        vmlinux
 1631.00  1.9% eth_header              vmlinux
 1440.00  1.7% _raw_read_unlock_bh     vmlinux

Reference results, if IP route cache is enabled :

real	0m29.718s
user	0m10.845s
sys	7m37.341s

25213.00 29.5% __ip_route_output_key   vmlinux
 9011.00 10.5% dst_release             vmlinux
 4817.00  5.6% ip_push_pending_frames  vmlinux
 4232.00  5.0% ip_finish_output        vmlinux
 3940.00  4.6% udp_sendmsg             vmlinux
 3730.00  4.4% __copy_from_user_ll     vmlinux
 3716.00  4.4% ip_route_output_flow    vmlinux
 2451.00  2.9% __xfrm_lookup           vmlinux
 2221.00  2.6% ip_append_data          vmlinux
 1718.00  2.0% _raw_spin_lock_bh       vmlinux
 1655.00  1.9% __alloc_skb             vmlinux
 1572.00  1.8% sock_wfree              vmlinux
 1345.00  1.6% kfree                   vmlinux

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-10-05 20:39:38 -07:00
..
netfilter Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-09-27 01:03:03 -07:00
af_inet.c net: build_ehash_secret() and rt_bind_peer() cleanups 2010-08-20 00:50:16 -07:00
ah4.c
arp.c net neigh: RCU conversion of neigh hash table 2010-10-05 14:54:36 -07:00
cipso_ipv4.c
datagram.c net: return operator cleanup 2010-09-23 14:33:39 -07:00
devinet.c ipv4: ip_ptr cleanups 2010-09-15 22:06:05 -07:00
esp4.c
fib_frontend.c fib: RCU conversion of fib_lookup() 2010-10-05 20:39:38 -07:00
fib_hash.c fib: RCU conversion of fib_lookup() 2010-10-05 20:39:38 -07:00
fib_lookup.h fib: RCU conversion of fib_lookup() 2010-10-05 20:39:38 -07:00
fib_rules.c fib: RCU conversion of fib_lookup() 2010-10-05 20:39:38 -07:00
fib_semantics.c fib: RCU conversion of fib_lookup() 2010-10-05 20:39:38 -07:00
fib_trie.c fib: RCU conversion of fib_lookup() 2010-10-05 20:39:38 -07:00
gre.c gre: protocol table can be static 2010-10-03 21:50:51 -07:00
icmp.c net: simplify flags for tx timestamping 2010-08-19 00:08:30 -07:00
igmp.c bonding: fix to rejoin multicast groups immediately 2010-10-05 20:26:57 -07:00
inet_connection_sock.c net/ipv4: EXPORT_SYMBOL cleanups 2010-07-12 12:57:54 -07:00
inet_diag.c net: return operator cleanup 2010-09-23 14:33:39 -07:00
inet_fragment.c net/ipv4: EXPORT_SYMBOL cleanups 2010-07-12 12:57:54 -07:00
inet_hashtables.c net/ipv4: EXPORT_SYMBOL cleanups 2010-07-12 12:57:54 -07:00
inet_lro.c
inet_timewait_sock.c
inetpeer.c inetpeer: restore small inet_peer structures 2010-06-16 11:55:39 -07:00
ip_forward.c net-next: remove useless union keyword 2010-06-10 23:31:35 -07:00
ip_fragment.c net: return operator cleanup 2010-09-23 14:33:39 -07:00
ip_gre.c net: add a core netdev->rx_dropped counter 2010-10-05 14:47:55 -07:00
ip_input.c net: use this_cpu_ptr() 2010-06-28 23:24:29 -07:00
ip_options.c bridge : Sanitize skb before it enters the IP stack 2010-09-19 12:42:34 -07:00
ip_output.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-09-27 01:03:03 -07:00
ip_sockglue.c ipv4: enable getsockopt() for IP_NODEFRAG 2010-09-13 19:57:23 -07:00
ipcomp.c
ipconfig.c
ipip.c net: add a core netdev->rx_dropped counter 2010-10-05 14:47:55 -07:00
ipmr.c ipmr: cleanups 2010-10-03 21:50:53 -07:00
Kconfig Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-10-04 11:56:38 -07:00
Makefile PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol) 2010-08-21 23:05:39 -07:00
netfilter.c Merge branch 'master' of /repos/git/net-next-2.6 2010-06-15 17:31:06 +02:00
proc.c snmp: 64bit ipstats_mib for all arches 2010-06-30 13:31:19 -07:00
protocol.c net: inet_add_protocol() can use cmpxchg() 2010-09-08 21:31:35 -07:00
raw.c net: simplify flags for tx timestamping 2010-08-19 00:08:30 -07:00
route.c fib: RCU conversion of fib_lookup() 2010-10-05 20:39:38 -07:00
syncookies.c syncookies: add support for ECN 2010-06-26 22:00:03 -07:00
sysctl_net_ipv4.c
tcp.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-10-04 11:56:38 -07:00
tcp_bic.c
tcp_cong.c net/ipv4: Eliminate kstrdup memory leak 2010-08-27 19:31:56 -07:00
tcp_cubic.c
tcp_diag.c
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c
tcp_illinois.c
tcp_input.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-10-04 11:56:38 -07:00
tcp_ipv4.c gro: unexport tcp4_gro_receive and tcp4_gro_complete 2010-08-31 13:37:07 -07:00
tcp_lp.c
tcp_minisocks.c net: return operator cleanup 2010-09-23 14:33:39 -07:00
tcp_output.c net: return operator cleanup 2010-09-23 14:33:39 -07:00
tcp_probe.c
tcp_scalable.c
tcp_timer.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-10-04 11:56:38 -07:00
tcp_vegas.c
tcp_vegas.h
tcp_veno.c
tcp_westwood.c net: return operator cleanup 2010-09-23 14:33:39 -07:00
tcp_yeah.c
tunnel4.c tunnels: missing rcu_assign_pointer() 2010-09-09 15:02:39 -07:00
udp.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-09-09 22:27:33 -07:00
udp_impl.h
udplite.c net/ipv4: EXPORT_SYMBOL cleanups 2010-07-12 12:57:54 -07:00
xfrm4_input.c net/ipv4: EXPORT_SYMBOL cleanups 2010-07-12 12:57:54 -07:00
xfrm4_mode_beet.c
xfrm4_mode_transport.c
xfrm4_mode_tunnel.c
xfrm4_output.c
xfrm4_policy.c xfrm4: strip ECN bits from tos field 2010-09-22 20:25:48 -07:00
xfrm4_state.c xfrm: Allow different selector family in temporary state 2010-09-20 11:11:38 -07:00
xfrm4_tunnel.c net: struct xfrm_tunnel in read_mostly section 2010-08-30 13:50:45 -07:00