path: root/sys/sys/_rmlock.h
diff options
authorJohn Baldwin <jhb@FreeBSD.org>2013-06-25 18:44:15 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2013-06-25 18:44:15 +0000
commitcd32bd7ad19a39a19789ffcc4d70dca646c3914b (patch)
tree7b07a13eb6ad28065286a3f60650edd2a6a0dc1c /sys/sys/_rmlock.h
parent874c906c45c9ff8d34af93bd28ef591684c7f1c0 (diff)
Several improvements to rmlock(9). Many of these are based on patches
provided by Isilon. - Add an rm_assert() supporting various lock assertions similar to other locking primitives. Because rmlocks track readers the assertions are always fully accurate unlike rw_assert() and sx_assert(). - Flesh out the lock class methods for rmlocks to support sleeping via condvars and rm_sleep() (but only while holding write locks), rmlock details in 'show lock' in DDB, and the lc_owner method used by dtrace. - Add an internal destroyed cookie so that API functions can assert that an rmlock is not destroyed. - Make use of rm_assert() to add various assertions to the API (e.g. to assert locks are held when an unlock routine is called). - Give RM_SLEEPABLE locks their own lock class and always use the rmlock's own lock_object with WITNESS. - Use THREAD_NO_SLEEPING() / THREAD_SLEEPING_OK() to disallow sleeping while holding a read lock on an rmlock. Submitted by: andre Obtained from: EMC/Isilon
Notes: svn path=/head/; revision=252209
Diffstat (limited to 'sys/sys/_rmlock.h')
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/sys/_rmlock.h b/sys/sys/_rmlock.h
index 09a59e03cf9b..8a3c871b4a67 100644
--- a/sys/sys/_rmlock.h
+++ b/sys/sys/_rmlock.h
@@ -44,14 +44,17 @@ struct rm_queue {
struct rmlock {
- struct lock_object lock_object;
+ struct lock_object lock_object;
volatile cpuset_t rm_writecpus;
LIST_HEAD(,rm_priotracker) rm_activeReaders;
union {
+ struct lock_object _rm_wlock_object;
struct mtx _rm_lock_mtx;
struct sx _rm_lock_sx;
} _rm_lock;
+#define rm_wlock_object _rm_lock._rm_wlock_object
#define rm_lock_mtx _rm_lock._rm_lock_mtx
#define rm_lock_sx _rm_lock._rm_lock_sx