freebsd-dev/sys/fs
Attilio Rao 047dd67e96 Optimize lockmgr in order to get rid of the pool mutex interlock, of the
state transitioning flags and of msleep(9) callings.
Use, instead, an algorithm very similar to what sx(9) and rwlock(9)
alredy do and direct accesses to the sleepqueue(9) primitive.

In order to avoid writer starvation a mechanism very similar to what
rwlock(9) uses now is implemented, with the correspective per-thread
shared lockmgrs counter.

This patch also adds 2 new functions to lockmgr KPI: lockmgr_rw() and
lockmgr_args_rw().  These two are like the 2 "normal" versions, but they
both accept a rwlock as interlock.  In order to realize this, the general
lockmgr manager function "__lockmgr_args()" has been implemented through
the generic lock layer. It supports all the blocking primitives, but
currently only these 2 mappers live.

The patch drops the support for WITNESS atm, but it will be probabilly
added soon. Also, there is a little race in the draining code which is
also present in the current CVS stock implementation: if some sharers,
once they wakeup, are in the runqueue they can contend the lock with
the exclusive drainer.  This is hard to be fixed but the now committed
code mitigate this issue a lot better than the (past) CVS version.
In addition assertive KA_HELD and KA_UNHELD have been made mute
assertions because they are dangerous and they will be nomore supported
soon.

In order to avoid namespace pollution, stack.h is splitted into two
parts: one which includes only the "struct stack" definition (_stack.h)
and one defining the KPI.  In this way, newly added _lockmgr.h can
just include _stack.h.

Kernel ABI results heavilly changed by this commit (the now committed
version of "struct lock" is a lot smaller than the previous one) and
KPI results broken by lockmgr_rw() / lockmgr_args_rw() introduction,
so manpages and __FreeBSD_version will be updated accordingly.

Tested by:      kris, pho, jeff, danger
Reviewed by:    jeff
Sponsored by:   Google, Summer of Code program 2007
2008-04-06 20:08:51 +00:00
..
cd9660 Cleanup lockmgr interface and exported KPI: 2008-01-24 12:34:30 +00:00
coda Add the support for the AT_FDCWD and fd-relative name lookups to the 2008-03-31 12:01:21 +00:00
deadfs Below is slightly edited description of the LOR by Tor Egge: 2007-01-22 11:25:22 +00:00
devfs Do not dereference cdev->si_cdevsw, use the dev_refthread() to properly 2008-03-20 16:08:42 +00:00
fdescfs The temporary workaround for the call to the vget() without lock type in 2008-04-04 09:37:57 +00:00
fifofs Remove kernel support for M:N threading. 2008-03-12 10:12:01 +00:00
hpfs Cleanup lockmgr interface and exported KPI: 2008-01-24 12:34:30 +00:00
msdosfs Add the support for the AT_FDCWD and fd-relative name lookups to the 2008-03-31 12:01:21 +00:00
ntfs Fix a lock leak in the ntfs locking scheme: 2008-02-13 13:02:12 +00:00
nullfs Add the support for the AT_FDCWD and fd-relative name lookups to the 2008-03-31 12:01:21 +00:00
nwfs Replace lockmgr lock protecting nwfs vnode hash table with an sx lock. 2008-03-02 19:02:30 +00:00
portalfs vn_lock() is currently only used with the 'curthread' passed as argument. 2008-01-10 01:10:58 +00:00
procfs Remove kernel support for M:N threading. 2008-03-12 10:12:01 +00:00
pseudofs Introduce some functions in the vnode locks namespace and in the ffs 2008-02-24 16:38:58 +00:00
smbfs Replace lockmgr lock protecting smbfs node hash table with sx lock. 2008-03-02 18:56:13 +00:00
tmpfs Add the new kernel-mode NFS Lock Manager. To use it instead of the 2008-03-26 15:23:12 +00:00
udf Cleanup lockmgr interface and exported KPI: 2008-01-24 12:34:30 +00:00
unionfs Optimize lockmgr in order to get rid of the pool mutex interlock, of the 2008-04-06 20:08:51 +00:00