cvs commit: src/sys/netinet in_pcb.h udp_usrreq.c
Robert Watson
rwatson at FreeBSD.org
Tue Jul 15 15:38:59 UTC 2008
rwatson 2008-07-15 15:38:47 UTC
FreeBSD src repository
Modified files:
sys/netinet in_pcb.h udp_usrreq.c
Log:
SVN rev 180536 on 2008-07-15 15:38:47Z by rwatson
Merge last of a series of rwlock conversion changes to UDP, which
completes the move to a fully parallel UDP transmit path by using
global read, rather than write, locking of inpcbinfo in further
semi-connected cases:
- Add macros to allow try-locking of inpcb and inpcbinfo.
- Always acquire an incpcb read lock in udp_output(), which stablizes the
local inpcb address and port bindings in order to determine what further
locking is required:
- If the inpcb is currently not bound (at all) and are implicitly
connecting, we require inpcbinfo and inpcb write locks, so drop the
read lock and re-acquire.
- If the inpcb is bound for at least one of the port or address, but an
explicit source or destination is requested, trylock the inpcbinfo
lock, and if that fails, drop the inpcb lock, lock the global lock,
and relock the inpcb lock.
- Otherwise, no further locking is required (common case).
- Update comments.
In practice, this means that the vast majority of consumers of UDP sockets
will not acquire any exclusive locks at the socket or UDP levels of the
network stack. This leads to a marked performance improvement in several
important workloads, including BIND, nsd, and memcached over UDP, as well
as significant improvements in pps microbenchmarks.
The plan is to MFC all of the rwlock changes to RELENG_7 once they have
settled for a weeks in the tree.
Tested by: ps, kris (older revision), bde
MFC after: 3 weeks
Revision Changes Path
1.110 +4 -0 src/sys/netinet/in_pcb.h
1.231 +85 -34 src/sys/netinet/udp_usrreq.c
More information about the cvs-src
mailing list