freebsd-skq/sys
John Baldwin 2498cf8c42 Add code to make default mutexes adaptive if the ADAPTIVE_MUTEXES kernel
option is used (not on by default).

- In the case of trying to lock a mutex, if the MTX_CONTESTED flag is set,
  then we can safely read the thread pointer from the mtx_lock member while
  holding sched_lock.  We then examine the thread to see if it is currently
  executing on another CPU.  If it is, then we keep looping instead of
  blocking.
- In the case of trying to unlock a mutex, it is now possible for a mutex
  to have MTX_CONTESTED set in mtx_lock but to not have any threads
  actually blocked on it, so we need to handle that case.  In that case,
  we just release the lock as if MTX_CONTESTED was not set and return.
- We do not adaptively spin on Giant as Giant is held for long times and
  it slows SMP systems down to a crawl (it was taking several minutes,
  like 5-10 or so for my test alpha and sparc64 SMP boxes to boot up when
  they adaptively spinned on Giant).
- We only compile in the code to do this for SMP kernels, it doesn't make
  sense for UP kernels.

Tested on:	i386, alpha, sparc64
2002-05-21 20:47:11 +00:00
..
alpha
amd64 Add an inline function cpu_pause() for the IA32 'pause' instruction. 2002-05-21 20:21:53 +00:00
arm
boot Fixed to conflict labels. 2002-05-21 12:53:48 +00:00
cam
coda
compat
conf Add code to make default mutexes adaptive if the ADAPTIVE_MUTEXES kernel 2002-05-21 20:47:11 +00:00
contrib
crypto
ddb
dev Use correct inactivity timeout of 2 minutes rather than 24 seconds due to 2002-05-20 19:33:49 +00:00
fs Fix null_lock() not unlocking vp->v_interlock if LK_THISLAYER. 2002-05-21 18:07:33 +00:00
geom Introduce the concept of "magic spaces", and implement them in most of 2002-05-21 20:33:49 +00:00
gnu
i4b
i386 Add an inline function cpu_pause() for the IA32 'pause' instruction. 2002-05-21 20:21:53 +00:00
ia64
isa
isofs/cd9660
kern Add code to make default mutexes adaptive if the ADAPTIVE_MUTEXES kernel 2002-05-21 20:47:11 +00:00
libkern
modules
net Avoid exposing struct if_clone and the sys/queue.h macros to userland 2002-05-20 22:48:39 +00:00
netatalk
netatm
netgraph
netinet - Change the newly turned INVARIANTS #ifdef blocks (they were changed from 2002-05-21 18:52:24 +00:00
netinet6
netipx
netkey
netnatm
netncp
netns
netsmb
nfs
nfsclient
nfsserver
pc98
pccard
pci
posix4
powerpc
rpc
security/lomac
sparc64 Update tsb_tte_enter prototype per tsb.c rev 1.20. 2002-05-21 02:15:37 +00:00
sys Optimize spin mutexes for UP kernels without debugging to just enter and 2002-05-21 20:34:28 +00:00
tools
ufs
vm In uma_zalloc_arg(), if we are performing a M_WAITOK allocation, ensure 2002-05-20 17:54:48 +00:00
Makefile