linux/net/ipv6
Eric Dumazet 645ca708f9 udp: introduce struct udp_table and multiple spinlocks
UDP sockets are hashed in a 128 slots hash table.

This hash table is protected by *one* rwlock.

This rwlock is readlocked each time an incoming UDP message is handled.

This rwlock is writelocked each time a socket must be inserted in
hash table (bind time), or deleted from this table (close time)

This is not scalable on SMP machines :

1) Even in read mode, lock() and unlock() are atomic operations and
 must dirty a contended cache line, shared by all cpus.

2) A writer might be starved if many readers are 'in flight'. This can
 happen on a machine with some NIC receiving many UDP messages. User
 process can be delayed a long time at socket creation/dismantle time.

This patch prepares RCU migration, by introducing 'struct udp_table
and struct udp_hslot', and using one spinlock per chain, to reduce
contention on central rwlock.

Introducing one spinlock per chain reduces latencies, for port
randomization on heavily loaded UDP servers. This also speedup
bindings to specific ports.

udp_lib_unhash() was uninlined, becoming to big.

Some cleanups were done to ease review of following patch
(RCUification of UDP Unicast lookups)

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-29 01:41:45 -07:00
..
netfilter net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
Kconfig ipsec: ipcomp - Merge IPComp implementations 2008-07-25 02:54:40 -07:00
Makefile [IPV6] MROUTE: Support multicast forwarding. 2008-04-05 22:33:38 +09:00
addrconf.c net: replace all current users of NIP6_SEQFMT with %#p6 2008-10-28 16:05:40 -07:00
addrconf_core.c [IPV6]: ipv6_addr_type() doesn't know about RFC4193 addresses. 2007-07-31 02:28:21 -07:00
addrlabel.c net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
af_inet6.c netns: mib6 section fixlet 2008-10-13 18:54:07 -07:00
ah6.c net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
anycast.c net: replace all current users of NIP6_SEQFMT with %#p6 2008-10-28 16:05:40 -07:00
datagram.c IPv6: datagram_send_ctl() should exit immediately when an error occured 2008-07-29 23:57:58 -07:00
esp6.c net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
exthdrs.c net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
exthdrs_core.c [NET] IPV6: Fix whitespace errors. 2007-02-10 23:19:42 -08:00
fib6_rules.c netns: Add network namespace argument to rt6_fill_node() and ipv6_dev_get_saddr() 2008-08-14 15:33:21 -07:00
icmp.c net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
inet6_connection_sock.c net: convert BUG_TRAP to generic WARN_ON 2008-07-25 21:43:18 -07:00
inet6_hashtables.c net: convert BUG_TRAP to generic WARN_ON 2008-07-25 21:43:18 -07:00
ip6_fib.c netns: Add network namespace argument to rt6_fill_node() and ipv6_dev_get_saddr() 2008-08-14 15:33:21 -07:00
ip6_flowlabel.c net: replace all current users of NIP6_SEQFMT with %#p6 2008-10-28 16:05:40 -07:00
ip6_input.c ipv6: added net argument to IP6_INC_STATS_BH 2008-10-08 11:09:27 -07:00
ip6_output.c net: reduce structures when XFRM=n 2008-10-28 13:24:06 -07:00
ip6_tunnel.c net: Use hton[sl]() instead of __constant_hton[sl]() where applicable 2008-09-20 22:20:49 -07:00
ip6mr.c net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
ipcomp6.c net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
ipv6_sockglue.c ipv6: Fix the return interface index when get it while no message is received. 2008-08-17 23:21:52 -07:00
mcast.c net: replace all current users of NIP6_SEQFMT with %#p6 2008-10-28 16:05:40 -07:00
mip6.c net: convert BUG_TRAP to generic WARN_ON 2008-07-25 21:43:18 -07:00
ndisc.c net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
netfilter.c netns: correct mib stats in ip6_route_me_harder() 2008-10-14 22:55:21 -07:00
proc.c ipv6: making ip and icmp statistics per/namespace 2008-10-08 11:16:45 -07:00
protocol.c net: remove CVS keywords 2008-06-11 21:00:38 -07:00
raw.c netns: add net parameter to IP6_INC_STATS 2008-10-08 10:54:51 -07:00
reassembly.c ipv6: added net argument to IP6_ADD_STATS_BH 2008-10-08 11:13:31 -07:00
route.c net: replace all current users of NIP6_SEQFMT with %#p6 2008-10-28 16:05:40 -07:00
sit.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2008-06-16 18:25:48 -07:00
syncookies.c tcp: Fix IPv6 fallout from 'Port redirection support for TCP' 2008-10-19 23:35:58 -07:00
sysctl_net_ipv6.c ipv6: sysctl fixes 2008-08-25 15:18:15 -07:00
tcp_ipv6.c net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
tunnel6.c [IPV6] TUNNEL6: Fix incoming packet length check for inter-protocol tunnel. 2008-06-05 04:02:32 +09:00
udp.c udp: introduce struct udp_table and multiple spinlocks 2008-10-29 01:41:45 -07:00
udp_impl.h udp: introduce struct udp_table and multiple spinlocks 2008-10-29 01:41:45 -07:00
udplite.c udp: introduce struct udp_table and multiple spinlocks 2008-10-29 01:41:45 -07:00
xfrm6_input.c [XFRM] IPV6: Optimize xfrm6_input_addr(). 2008-03-25 10:23:56 +09:00
xfrm6_mode_beet.c ipsec: Interfamily IPSec BEET, ipv4-inner ipv6-outer 2008-08-06 02:40:25 -07:00
xfrm6_mode_ro.c [IPSEC]: Make x->lastused an unsigned long 2008-01-28 14:53:52 -08:00
xfrm6_mode_transport.c [IPSEC]: Use IPv6 calling convention as the convention for x->mode->output 2007-10-10 16:55:54 -07:00
xfrm6_mode_tunnel.c [IPSEC]: Fix inter address family IPsec tunnel handling. 2008-03-24 14:51:51 -07:00
xfrm6_output.c [IPSEC]: Fix inter address family IPsec tunnel handling. 2008-03-24 14:51:51 -07:00
xfrm6_policy.c netns: Add network namespace argument to rt6_fill_node() and ipv6_dev_get_saddr() 2008-08-14 15:33:21 -07:00
xfrm6_state.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-03-27 18:48:56 -07:00
xfrm6_tunnel.c [XFRM] IPV6: Optimize __xfrm_tunnel_alloc_spi(). 2008-03-25 10:23:57 +09:00