freebsd-nq/sys
David Xu d10183d94d This is initial version of POSIX priority mutex support, a new userland
mutex structure is added as following:
struct umutex {
        __lwpid_t       m_owner;
        uint32_t        m_flags;
        uint32_t        m_ceilings[2];
        uint32_t        m_spare[4];
};
The m_owner represents owner thread, it is a thread id, in non-contested
case, userland can simply use atomic_cmpset_int to lock the mutex, if the
mutex is contested, high order bit will be set, and userland should do locking
and unlocking via kernel syscall. Flag UMUTEX_PRIO_INHERIT represents
pthread's PTHREAD_PRIO_INHERIT mutex, which when contention happens, kernel
should do priority propagating. Flag UMUTEX_PRIO_PROTECT indicates it is
pthread's PTHREAD_PRIO_PROTECT mutex, userland should initialize m_owner
to contested state UMUTEX_CONTESTED, then atomic_cmpset_int will be failure
and kernel syscall should be invoked to do locking, this becauses
for such a mutex, kernel should always boost the thread's priority before
it can lock the mutex, m_ceilings is used by PTHREAD_PRIO_PROTECT mutex,
the first element is used to boost thread's priority when it locked the mutex,
second element is used when the mutex is unlocked, the PTHREAD_PRIO_PROTECT
mutex's link list is kept in userland, the m_ceiling[1] is managed by thread
library so kernel needn't allocate memory to keep the link list, when such
a mutex is unlocked, kernel reset m_owner to UMUTEX_CONTESTED.
Flag USYNC_PROCESS_SHARED indicate if the synchronization object is process
shared, if the flag is not set, it saves a vm_map_lookup() call.

The umtx chain is still used as a sleep queue, when a thread is blocked on
PTHREAD_PRIO_INHERIT mutex, a umtx_pi is allocated to support priority
propagating, it is dynamically allocated and reference count is used,
it is not optimized but works well in my tests, while the umtx chain has
its own locking protocol, the priority propagating protocol are all protected
by sched_lock because priority propagating function is called with sched_lock
held from scheduler.

No visible performance degradation is found which these changes. Some parameter
names in _umtx_op syscall are renamed.
2006-08-28 04:24:51 +00:00
..
amd64 Implement casuword32, compare and set user integer, thank Marcel Moolenarr 2006-08-28 02:28:15 +00:00
arm Implement casuword32, compare and set user integer, thank Marcel Moolenarr 2006-08-28 02:28:15 +00:00
boot Make the default "init_path" value breakable, so it fits on the 2006-08-20 09:31:17 +00:00
bsm Update kernel OpenBSM parts, especially src/sys/bsm, for the OpenBSM 2006-08-26 08:17:58 +00:00
cam Implement 'camcontrol reportluns'. This allows users to send the SCSI 2006-08-21 13:24:50 +00:00
coda Since DELAY() was moved, most <machine/clock.h> #includes have been 2006-05-16 14:37:58 +00:00
compat Add the linux statfs64 call. This allows Tivoli backup to proceed a little 2006-08-27 08:56:54 +00:00
conf Resurrect reference to (contemporary) kern.ipc.nmbclusters. 2006-08-27 12:57:37 +00:00
contrib Resolve conflicts 2006-08-16 12:06:35 +00:00
crypto GCC 3.4.6 gets confused on this file and produces bogus warning. 2006-08-26 21:48:00 +00:00
ddb Fix two nits in the ps header that offset each other making them largely 2006-08-01 22:30:55 +00:00
dev Add QLogic 2400 (4Gb) firmware. 2006-08-26 18:39:18 +00:00
fs while (0); -> while (0) in multi-line macros 2006-08-17 22:50:33 +00:00
gdb Convert to new console api 2006-05-26 13:54:27 +00:00
geom while (0); -> while (0) in multi-line macros 2006-08-17 22:50:33 +00:00
gnu Add snd_emu10kx driver for Creative SoundBlaster Live! and Audigy series 2006-07-15 19:36:28 +00:00
i4b Extend i4b to support CAPI manager based ISDN controllers (CAPI manager is part of 2006-07-09 21:16:06 +00:00
i386 Implement casuword32, compare and set user integer, thank Marcel Moolenarr 2006-08-28 02:28:15 +00:00
ia64 Implement casuword32, compare and set user integer, thank Marcel Moolenarr 2006-08-28 02:28:15 +00:00
isa Eliminate one set of XBOX #ifdefs. The Xbox code just needs to set a 2006-08-09 23:47:38 +00:00
isofs/cd9660 Remove calls to vfs_export() for exporting a filesystem for NFS mounting 2006-05-26 00:32:21 +00:00
kern This is initial version of POSIX priority mutex support, a new userland 2006-08-28 04:24:51 +00:00
libkern Add strstr() function to the libkern. 2006-08-12 15:28:39 +00:00
modules Add 2400 f/w support. 2006-08-26 18:40:25 +00:00
net Move the bridge hook after the loopback check so that IFF_SIMPLEX is honoured 2006-08-25 20:16:39 +00:00
net80211 More statistics fixups: 2006-08-10 06:04:00 +00:00
netatalk Since soisdisconnected() is no longer called in pru_detach(), call it 2006-08-05 14:14:34 +00:00
netatm Change semantics of socket close and detach. Add a new protocol switch 2006-07-21 17:11:15 +00:00
netgraph - Catch up with ongoing rwatson's socket work; 2006-08-25 17:53:13 +00:00
netinet Fix for a bug that causes the computation of "len" in tcp_output() to 2006-08-26 17:53:19 +00:00
netinet6 With exception of the if_name() macro, all definitions in net_osdep.h 2006-08-04 21:27:40 +00:00
netipsec Fix build breakage from previous commit which confused key_abort and key_close. 2006-07-22 09:18:02 +00:00
netipx Change semantics of socket close and detach. Add a new protocol switch 2006-07-21 17:11:15 +00:00
netkey With exception of the if_name() macro, all definitions in net_osdep.h 2006-08-04 21:27:40 +00:00
netnatm Change semantics of socket close and detach. Add a new protocol switch 2006-07-21 17:11:15 +00:00
netncp - Fix ncp_poll() to not panic if the socket doesn't have any pending data. 2006-08-03 15:31:52 +00:00
netsmb Fix misalignment bugs caused by invalid type casts of pointers 2006-08-22 03:05:51 +00:00
nfs
nfs4client Always supply curthread as argument to nfs_asyncio and nfs_doio 2006-07-12 09:16:35 +00:00
nfsclient Fix typos in comment. 2006-08-16 23:53:05 +00:00
nfsserver - Add a new function nfsrv_destroycache() to tear down the server request 2006-08-01 16:27:14 +00:00
opencrypto When DIAGNOSTIC is defined, verify if we don't free crypto requests from 2006-06-06 15:04:52 +00:00
pc98 Add pc98 specific code to adjust the firmware geometry when it differs 2006-08-09 18:25:07 +00:00
pccard
pci Use aperture base address from north bridge. Some BIOS does not encode 2006-08-21 19:10:58 +00:00
posix4 Backout the feature which can change thread's scheduling option, I really 2006-07-13 06:41:26 +00:00
powerpc Implement casuword32, compare and set user integer, thank Marcel Moolenarr 2006-08-28 02:28:15 +00:00
rpc
security Fix panic associated with file creation via RPC/NFS when the MLS policy 2006-08-26 20:13:35 +00:00
sparc64 Implement casuword32, compare and set user integer, thank Marcel Moolenarr 2006-08-28 02:28:15 +00:00
sys This is initial version of POSIX priority mutex support, a new userland 2006-08-28 04:24:51 +00:00
tools Check for errors when registering and unregistering firmware modules. This 2006-06-16 21:06:03 +00:00
ufs While checking for update of snapshot file in the ffs_copyonwrite, 2006-08-21 17:20:19 +00:00
vm Refactor vm_page_sleep_if_busy() so that the test for a busy page is 2006-08-27 19:50:13 +00:00
Makefile Don't need to special case arm here anymore 2006-08-10 06:29:43 +00:00