locks: let primitives for modules unlock without always goging to the slsow path

It is only needed if the LOCK_PROFILING is enabled. It has to always check if
the lock is about to be released which requires an avoidable read if the option
is not specified..
This commit is contained in:
Mateusz Guzik 2017-02-17 05:39:40 +00:00
parent 7a465c285f
commit ffd5c94c4f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313855
3 changed files with 12 additions and 0 deletions

View File

@ -275,7 +275,11 @@ __mtx_unlock_flags(volatile uintptr_t *c, int opts, const char *file, int line)
line);
mtx_assert(m, MA_OWNED);
#ifdef LOCK_PROFILING
__mtx_unlock_sleep(c, opts, file, line);
#else
__mtx_unlock(m, curthread, opts, file, line);
#endif
TD_LOCKS_DEC(curthread);
}

View File

@ -341,7 +341,11 @@ _rw_wunlock_cookie(volatile uintptr_t *c, const char *file, int line)
LOCK_LOG_LOCK("WUNLOCK", &rw->lock_object, 0, rw->rw_recurse, file,
line);
#ifdef LOCK_PROFILING
_rw_wunlock_hard(rw, (uintptr_t)curthread, file, line);
#else
__rw_wunlock(rw, curthread, file, line);
#endif
TD_LOCKS_DEC(curthread);
}

View File

@ -364,7 +364,11 @@ _sx_xunlock(struct sx *sx, const char *file, int line)
WITNESS_UNLOCK(&sx->lock_object, LOP_EXCLUSIVE, file, line);
LOCK_LOG_LOCK("XUNLOCK", &sx->lock_object, 0, sx->sx_recurse, file,
line);
#ifdef LOCK_PROFILING
_sx_xunlock_hard(sx, (uintptr_t)curthread, file, line);
#else
__sx_xunlock(sx, curthread, file, line);
#endif
TD_LOCKS_DEC(curthread);
}