path: root/sys/sys/_rmlock.h
diff options
authorMax Laier <mlaier@FreeBSD.org>2010-09-01 19:50:03 +0000
committerMax Laier <mlaier@FreeBSD.org>2010-09-01 19:50:03 +0000
commit36058c09e4c0709b2d29c5e31efe0aa48acae329 (patch)
treed9a5617b3239cbe92a3581fdb4eb3dbcf7d29261 /sys/sys/_rmlock.h
parenta629f2b183dfeb553108d90f39c86aae71542e7b (diff)
rmlock(9) two additions and one change/fix:
- add rm_try_rlock(). - add RM_SLEEPABLE to use sx(9) as the back-end lock in order to sleep while holding the write lock. - change rm_noreadtoken to a cpu bitmask to indicate which CPUs need to go through the lock/unlock in order to synchronize. As a side effect, this also avoids IPI to CPUs without any readers during rm_wlock. Discussed with: ups@, rwatson@ on arch@ Sponsored by: Isilon Systems, Inc.
Notes: svn path=/head/; revision=212112
Diffstat (limited to 'sys/sys/_rmlock.h')
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/sys/_rmlock.h b/sys/sys/_rmlock.h
index e5c68d54732d..75a159c1082e 100644
--- a/sys/sys/_rmlock.h
+++ b/sys/sys/_rmlock.h
@@ -45,11 +45,15 @@ LIST_HEAD(rmpriolist,rm_priotracker);
struct rmlock {
struct lock_object lock_object;
- volatile int rm_noreadtoken;
+ volatile cpumask_t rm_writecpus;
LIST_HEAD(,rm_priotracker) rm_activeReaders;
- struct mtx rm_lock;
+ union {
+ struct mtx _rm_lock_mtx;
+ struct sx _rm_lock_sx;
+ } _rm_lock;
+#define rm_lock_mtx _rm_lock._rm_lock_mtx
+#define rm_lock_sx _rm_lock._rm_lock_sx
struct rm_priotracker {
struct rm_queue rmp_cpuQueue; /* Must be first */