freebsd-skq/sys
Robert Watson 252ca42863 Move from solely write-locking the global tcbinfo in tcp_input()
to read-locking in the TCP input path, allowing greater TCP
input parallelism where multiple ithreads or ithread and netisr
are able to run in parallel.  Previously, most TCP input paths
held a write lock on the global tcbinfo lock, effectively
serializing TCP input.

Before looking up the connection, acquire a write lock if a
potentially state-changing flag is set on the TCP segment header
(FIN, RST, SYN), and otherwise a read lock.  We may later have
to upgrade to a write lock in certain cases (ACKs received by the
syncache or during TIMEWAIT) in order to support global state
transitions, but this is never required for steady-state packets.

Upgrading from a write lock to a read lock must be done as a
trylock operation to avoid deadlocks, and actually violates the
lock order as the tcbinfo lock preceeds the inpcb lock held at
the time of upgrade.  If the trylock fails, we bump the refcount
on the inpcb, drop both locks, and re-acquire in-order.  If
another thread has freed the connection while the locks are
dropped, we free the inpcb and repeat the lookup (this should
hardly ever or never happen in practice).

For now, maintain a number of new counters measuring how many
times various cases execute, and in particular whether various
optimistic assumptions about when read locks can be used, whether
upgrades are done using the fast path, and whether connections
close in practice in the above-described race, actually occur.

MFC after:	6 weeks
Discussed with:	kmacy
Reviewed by:	bz, gnn, kmacy
Tested by:	kmacy
2008-12-08 20:27:00 +00:00
..
amd64 Change the default value for the flag enabling superpage mapping and 2008-12-06 19:37:52 +00:00
arm Avoid confusion and adjust link address range of Marvell Orion kernel so it is 2008-12-05 15:31:51 +00:00
boot PROBLEM: putting in a loader config file a line of the form 2008-12-07 19:42:20 +00:00
bsm Merge OpenBSM 1.1 alpha 2 from the OpenBSM vendor branch to head, both 2008-12-02 23:26:43 +00:00
cam Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
cddl Put the MIPS support back in after it was removed in r185029. 2008-12-04 16:31:08 +00:00
compat Make two style changes to create new commit and document proper commit 2008-12-08 13:15:31 +00:00
conf Integrate 185578 from dfr 2008-12-04 07:59:05 +00:00
contrib - convert radix node head lock from mutex to rwlock 2008-12-07 21:15:43 +00:00
crypto Fix a potential NULL-pointer dereference in padlock(4). 2008-11-17 19:00:36 +00:00
ddb Collect N identical (or near identical) mkdumpheader() implementations into 2008-10-01 22:08:53 +00:00
dev mutex.h is needed here. It got it by namespace pollution. 2008-12-08 03:48:03 +00:00
fs Make two style changes to create new commit and document proper commit 2008-12-08 13:15:31 +00:00
gdb
geom - Add missing word in comment. 2008-12-08 17:09:02 +00:00
gnu Adapt to accmode_t changes. 2008-11-14 09:58:16 +00:00
i386 Restore memory clobber, to cause mb on the compiler level too. 2008-12-06 21:33:44 +00:00
ia64 Remove "[KEEP THIS!]" from COMPAT_43TTY. It's not really that important. 2008-12-02 19:09:08 +00:00
isa Allow device hints to wire the unit numbers of devices. 2008-11-18 21:01:54 +00:00
kern - Detect Bochs BIOS variants and use HZ_VM as well. 2008-12-08 18:39:59 +00:00
kgssapi Call svc_freereq() before returning from the service proc. 2008-11-12 15:31:05 +00:00
libkern Add simple locking for the in-kernel iconv code. Translation operations 2008-12-05 21:19:24 +00:00
mips Switch to ath hal source code. Note this removes the ath_hal 2008-12-01 16:53:01 +00:00
modules Rather than using hidden includes (with cicular dependencies), 2008-12-02 21:37:28 +00:00
net - avoid recursively locking the radix node head lock 2008-12-08 20:21:57 +00:00
net80211 Rather than using hidden includes (with cicular dependencies), 2008-12-02 21:37:28 +00:00
netatalk Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
netgraph Carefully handle memory errors to keep peers compression/encryption state 2008-12-06 23:00:48 +00:00
netinet Move from solely write-locking the global tcbinfo in tcp_input() 2008-12-08 20:27:00 +00:00
netinet6 Add missing include to sys/lock.h before sys/rwlock.h 2008-12-08 00:28:21 +00:00
netipsec Rather than using hidden includes (with cicular dependencies), 2008-12-02 21:37:28 +00:00
netipx Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
netnatm Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
netncp Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
netsmb Implement device cloning for /dev/nsmb, the netsmb control pseudo-device. 2008-11-03 14:23:15 +00:00
nfs
nfs4client Introduce accmode_t. This is required for NFSv4 ACLs - it will be neccessary 2008-10-28 13:44:11 +00:00
nfsclient Rather than using hidden includes (with cicular dependencies), 2008-12-02 21:37:28 +00:00
nfsserver Change nfsserver slightly so that it does not trip over the timestamp 2008-12-03 17:54:09 +00:00
nlm Don't call svc_freereq() before svc_freeargs(). 2008-11-12 15:30:30 +00:00
opencrypto Don't hang if encrypting/decrypting using struct iovecs where one of the 2008-10-30 16:11:07 +00:00
pc98 Remove "[KEEP THIS!]" from COMPAT_43TTY. It's not really that important. 2008-12-02 19:09:08 +00:00
pccard
pci o Implemented miibus_statchg handler. It detects whether re(4) 2008-12-08 02:34:13 +00:00
powerpc Clean up the mac GPIO interface a little. Also remove bogus copyright 2008-12-08 03:00:45 +00:00
rpc Add a missing call to mtx_destroy(). 2008-11-12 12:21:18 +00:00
security Merge OpenBSM 1.1 alpha 2 from the OpenBSM vendor branch to head, both 2008-12-02 23:26:43 +00:00
sparc64 Remove "[KEEP THIS!]" from COMPAT_43TTY. It's not really that important. 2008-12-02 19:09:08 +00:00
sun4v Remove "[KEEP THIS!]" from COMPAT_43TTY. It's not really that important. 2008-12-02 19:09:08 +00:00
sys Several threads in a process may do vfork() simultaneously. Then, all 2008-12-05 20:50:24 +00:00
tools Remove some unused and broken code that attempted to not invoke locking 2008-11-03 19:57:40 +00:00
ufs The dqrele() function syncs the dq, then acquires the dqh lock, and then 2008-12-08 11:04:17 +00:00
vm Instead of forcing vn_start_write() to reset mp back to NULL for the 2008-11-16 21:57:54 +00:00
xdr Use the remote address for access control, not the local address. This fixes 2008-11-13 14:36:52 +00:00
xen Integrate 185578 from dfr 2008-12-04 07:59:05 +00:00
Makefile