diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2002-03-27 09:23:41 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2002-03-27 09:23:41 +0000 |
commit | f22a4b62f55c8b5e563f72c12f6b425cb165a054 (patch) | |
tree | 881b84f9e9297329d00cba858d3818a9c74d2de5 /sys/kern/kern_mutex.c | |
parent | e6bbfd402d2ebfd71da740ad7138188c5939e484 (diff) | |
download | src-f22a4b62f55c8b5e563f72c12f6b425cb165a054.tar.gz src-f22a4b62f55c8b5e563f72c12f6b425cb165a054.zip |
Add a new mtx_init option "MTX_DUPOK" which allows duplicate acquires of locks
with this flag. Remove the dup_list and dup_ok code from subr_witness. Now
we just check for the flag instead of doing string compares.
Also, switch the process lock, process group lock, and uma per cpu locks over
to this interface. The original mechanism did not work well for uma because
per cpu lock names are unique to each zone.
Approved by: jhb
Notes
Notes:
svn path=/head/; revision=93273
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r-- | sys/kern/kern_mutex.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index 6847cde639d3..95edd18ac3c6 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -625,7 +625,7 @@ mtx_init(struct mtx *m, const char *description, int opts) struct lock_object *lock; MPASS((opts & ~(MTX_SPIN | MTX_QUIET | MTX_RECURSE | - MTX_SLEEPABLE | MTX_NOWITNESS)) == 0); + MTX_SLEEPABLE | MTX_NOWITNESS | MTX_DUPOK)) == 0); #ifdef MUTEX_DEBUG /* Diagnostic and error correction */ @@ -649,6 +649,8 @@ mtx_init(struct mtx *m, const char *description, int opts) lock->lo_flags |= LO_SLEEPABLE; if ((opts & MTX_NOWITNESS) == 0) lock->lo_flags |= LO_WITNESS; + if (opts & MTX_DUPOK) + lock->lo_flags |= LO_DUPOK; m->mtx_lock = MTX_UNOWNED; TAILQ_INIT(&m->mtx_blocked); |