From dff418f166b9e0d1e38094ab3bb7b6a6812ec6bb Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 27 Mar 2002 09:23:41 +0000 Subject: 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 --- sys/kern/subr_turnstile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys/kern/subr_turnstile.c') diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c index 6847cde..95edd18 100644 --- a/sys/kern/subr_turnstile.c +++ b/sys/kern/subr_turnstile.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); -- cgit v1.1