kernel-hacking-2024-linux-s.../net/ipv4
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 netfilter: snmp nat leaks memory in case of failure 2008-10-20 03:33:24 -07:00
af_inet.c ipv4: Allow binding to non-local addresses if IP_TRANSPARENT is set 2008-10-01 07:31:24 -07:00
ah4.c
arp.c netfilter: replace old NF_ARP calls with NFPROTO_ARP 2008-10-20 03:34:51 -07:00
cipso_ipv4.c net: don't use INIT_RCU_HEAD 2008-10-28 13:25:09 -07:00
datagram.c
devinet.c net: don't use INIT_RCU_HEAD 2008-10-28 13:25:09 -07:00
esp4.c
fib_frontend.c
fib_hash.c
fib_lookup.h
fib_rules.c
fib_semantics.c
fib_trie.c
icmp.c net: reduce structures when XFRM=n 2008-10-28 13:24:06 -07:00
igmp.c net: Rationalise email address: Network Specific Parts 2008-10-13 19:01:08 -07:00
inet_connection_sock.c inet: cleanup of local_port_range 2008-10-08 14:18:04 -07:00
inet_diag.c net: Remove CONFIG_KMOD from net/ (towards removing CONFIG_KMOD entirely) 2008-10-16 15:24:51 -07:00
inet_fragment.c
inet_hashtables.c
inet_lro.c
inet_timewait_sock.c ipv4: Implement IP_TRANSPARENT socket option 2008-10-01 07:30:02 -07:00
inetpeer.c
ip_forward.c net: reduce structures when XFRM=n 2008-10-28 13:24:06 -07:00
ip_fragment.c net: Rationalise email address: Network Specific Parts 2008-10-13 19:01:08 -07:00
ip_gre.c gre: Initialise rtnl_link tunnel parameters properly 2008-10-11 12:20:15 -07:00
ip_input.c net: Rationalise email address: Network Specific Parts 2008-10-13 19:01:08 -07:00
ip_options.c cipso: Add support for native local labeling and fixup mapping names 2008-10-10 10:16:34 -04:00
ip_output.c ipv4: Make Netfilter's ip_route_me_harder() non-local address compatible 2008-10-01 07:44:42 -07:00
ip_sockglue.c ipv4: Implement IP_TRANSPARENT socket option 2008-10-01 07:30:02 -07:00
ipcomp.c
ipconfig.c
ipip.c net: Rationalise email address: Network Specific Parts 2008-10-13 19:01:08 -07:00
ipmr.c net: Rationalise email address: Network Specific Parts 2008-10-13 19:01:08 -07:00
Kconfig IPVS: Move IPVS to net/netfilter/ipvs 2008-10-07 08:38:24 +11:00
Makefile IPVS: Move IPVS to net/netfilter/ipvs 2008-10-07 08:38:24 +11:00
netfilter.c netfilter: netns: fix {ip,6}_route_me_harder() in netns 2008-10-08 11:35:03 +02:00
proc.c
protocol.c
raw.c
route.c net: don't use INIT_RCU_HEAD 2008-10-28 13:25:09 -07:00
syncookies.c tcp: Port redirection support for TCP 2008-10-01 07:46:49 -07:00
sysctl_net_ipv4.c net: implement emergency route cache rebulds when gc_elasticity is exceeded 2008-10-27 17:06:14 -07:00
tcp.c tcp: kill pointless urg_mode 2008-10-07 14:43:06 -07:00
tcp_bic.c
tcp_cong.c net: Remove CONFIG_KMOD from net/ (towards removing CONFIG_KMOD entirely) 2008-10-16 15:24:51 -07:00
tcp_cubic.c
tcp_diag.c
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c tcp: Fix tcp_hybla zero congestion window growth with small rho and large cwnd. 2008-10-07 15:58:17 -07:00
tcp_illinois.c
tcp_input.c net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
tcp_ipv4.c tcpv[46]: fix md5 pseudoheader address field ordering 2008-10-09 14:37:47 -07:00
tcp_lp.c
tcp_minisocks.c tcp: kill pointless urg_mode 2008-10-07 14:43:06 -07:00
tcp_output.c syncookies: fix inclusion of tcp options in syn-ack 2008-10-26 23:10:12 -07:00
tcp_probe.c
tcp_scalable.c
tcp_timer.c net: replace uses of NIP6_FMT with %p6 2008-10-28 23:02:31 -07:00
tcp_vegas.c
tcp_vegas.h
tcp_veno.c
tcp_westwood.c
tcp_yeah.c
tunnel4.c
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
xfrm4_input.c
xfrm4_mode_beet.c
xfrm4_mode_transport.c
xfrm4_mode_tunnel.c
xfrm4_output.c
xfrm4_policy.c
xfrm4_state.c
xfrm4_tunnel.c