linux/net
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
..
9p 9p: fix sparse warnings 2008-10-22 18:54:47 -05:00
802 net: convert print_mac to %pM 2008-10-27 17:06:18 -07:00
8021q vlan: propogate ethtool speed values 2008-10-28 23:02:34 -07:00
appletalk net: convert print_mac to %pM 2008-10-27 17:06:18 -07:00
atm net: convert print_mac to %pM 2008-10-27 17:06:18 -07:00
ax25 ax25: Quick fix for making sure unaccepted sockets get destroyed. 2008-10-06 12:53:50 -07:00
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-10-17 08:58:52 -07:00
bridge net: remove NIP6(), NIP6_FMT, NIP6_SEQFMT and final users 2008-10-28 23:02:38 -07:00
can net: Remove CONFIG_KMOD from net/ (towards removing CONFIG_KMOD entirely) 2008-10-16 15:24:51 -07:00
core net: don't use INIT_RCU_HEAD 2008-10-28 13:25:09 -07:00
dccp dccp: Port redirection support for DCCP 2008-10-19 23:36:47 -07:00
decnet Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-10-17 08:58:52 -07:00
dsa dsa: fix compile bug on s390 2008-10-13 18:58:48 -07:00
econet netns: Use net_eq() to compare net-namespaces for optimization. 2008-07-19 22:34:43 -07:00
ethernet dsa: add support for Trailer tagging format 2008-10-08 17:24:16 -07:00
ieee80211 net: convert print_mac to %pM 2008-10-27 17:06:18 -07:00
ipv4 udp: introduce struct udp_table and multiple spinlocks 2008-10-29 01:41:45 -07:00
ipv6 udp: introduce struct udp_table and multiple spinlocks 2008-10-29 01:41:45 -07:00
ipx netns: Use net_eq() to compare net-namespaces for optimization. 2008-07-19 22:34:43 -07:00
irda net: convert print_mac to %pM 2008-10-27 17:06:18 -07:00
iucv iucv: Fix mismerge again. 2008-09-30 03:03:35 -07:00
key af_key: fix SADB_X_SPDDELETE response 2008-10-10 14:07:03 -07:00
lapb [LAPB] net/lapb/lapb_iface.c: use LIST_HEAD instead of LIST_HEAD_INIT 2008-01-28 14:56:52 -08:00
llc net: convert print_mac to %pM 2008-10-27 17:06:18 -07:00
mac80211 mac80211: convert to %pM away from print_mac 2008-10-27 17:06:16 -07:00
netfilter netfilter: replace uses of NIP6_FMT with %p6 2008-10-28 16:08:13 -07:00
netlabel net, misc: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:32 -07:00
netlink netlink: constify struct nlattr * arg to parsing functions 2008-10-28 11:59:11 -07:00
netrom netrom: Fix sock_orphan() use in nr_release 2008-10-06 12:54:57 -07:00
packet net: convert BUG_TRAP to generic WARN_ON 2008-07-25 21:43:18 -07:00
phonet Phonet: do not reply to indication reset packets 2008-10-26 23:07:25 -07:00
rfkill net/rfkill/rfkill-input.c needs <linux/sched.h> 2008-10-14 10:23:27 -07:00
rose netdev: Handle ->addr_list_lock just like ->_xmit_lock for lockdep. 2008-07-22 14:16:42 -07:00
rxrpc net/rxrpc: Use an IS_ERR test rather than a NULL test 2008-08-13 02:40:48 -07:00
sched Merge branch 'timers/range-hrtimers' into v28-range-hrtimers-for-linus-v2 2008-10-22 09:48:06 +02:00
sctp net, misc: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:32 -07:00
sunrpc net: remove NIP6(), NIP6_FMT, NIP6_SEQFMT and final users 2008-10-28 23:02:38 -07:00
tipc net: convert print_mac to %pM 2008-10-27 17:06:18 -07:00
unix [PATCH] assorted path_lookup() -> kern_path() conversions 2008-10-23 05:12:52 -04:00
wanrouter wanmain.c doesn't need syncppp.h 2008-07-23 23:00:36 +02:00
wireless wireless: fix regression caused by regulatory config option 2008-10-26 10:38:52 -07:00
x25 netns: Use net_eq() to compare net-namespaces for optimization. 2008-07-19 22:34:43 -07:00
xfrm net, misc: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:32 -07:00
Kconfig netns: Coexist with the sysfs limitations v2 2008-10-27 17:51:47 -07:00
Makefile net: Distributed Switch Architecture protocol support 2008-10-08 17:15:19 -07:00
TUNABLE
compat.c flag parameters: paccept 2008-07-24 10:47:27 -07:00
nonet.c
socket.c net: Remove CONFIG_KMOD from net/ (towards removing CONFIG_KMOD entirely) 2008-10-16 15:24:51 -07:00
sysctl_net.c missing bits of net-namespace / sysctl 2008-07-27 09:45:34 -07:00