1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-26 11:47:31 +00:00

mtx: restrict r313875 to kernels without LOCK_PROFILING

This commit is contained in:
Mateusz Guzik 2017-02-17 15:34:40 +00:00
parent 7640beb920
commit 09f1319acd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313877
2 changed files with 28 additions and 0 deletions

View File

@ -423,9 +423,14 @@ _mtx_trylock_flags_(volatile uintptr_t *c, int opts, const char *file, int line)
* We call this if the lock is either contested (i.e. we need to go to
* sleep waiting for it), or if we need to recurse on it.
*/
#if LOCK_DEBUG > 0
void
__mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid, int opts,
const char *file, int line)
#else
void
__mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid, int opts)
#endif
{
struct mtx *m;
struct turnstile *ts;
@ -485,7 +490,11 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid, int opts,
"_mtx_lock_sleep: %s contested (lock=%p) at %s:%d",
m->lock_object.lo_name, (void *)m->mtx_lock, file, line);
#ifdef KDTRACE_HOOKS
#ifdef LOCK_PROFILING
doing_lockstat = 1;
#else
doing_lockstat = lockstat_enabled;
#endif
if (__predict_false(doing_lockstat))
all_time -= lockstat_nsecs(&m->lock_object);
#endif
@ -859,8 +868,13 @@ thread_lock_set(struct thread *td, struct mtx *new)
* We are only called here if the lock is recursed, contested (i.e. we
* need to wake up a blocked thread) or lockstat probe is active.
*/
#if LOCK_DEBUG > 0
void
__mtx_unlock_sleep(volatile uintptr_t *c, int opts, const char *file, int line)
#else
void
__mtx_unlock_sleep(volatile uintptr_t *c, int opts)
#endif
{
struct mtx *m;
struct turnstile *ts;

View File

@ -98,10 +98,17 @@ void mtx_sysinit(void *arg);
int _mtx_trylock_flags_(volatile uintptr_t *c, int opts, const char *file,
int line);
void mutex_init(void);
#if LOCK_DEBUG > 0
void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid,
int opts, const char *file, int line);
void __mtx_unlock_sleep(volatile uintptr_t *c, int opts, const char *file,
int line);
#else
void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid,
int opts);
void __mtx_unlock_sleep(volatile uintptr_t *c, int opts);
#endif
#ifdef SMP
void _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t v, uintptr_t tid,
int opts, const char *file, int line);
@ -140,10 +147,17 @@ void thread_lock_flags_(struct thread *, int, const char *, int);
_mtx_destroy(&(m)->mtx_lock)
#define mtx_trylock_flags_(m, o, f, l) \
_mtx_trylock_flags_(&(m)->mtx_lock, o, f, l)
#if LOCK_DEBUG > 0
#define _mtx_lock_sleep(m, v, t, o, f, l) \
__mtx_lock_sleep(&(m)->mtx_lock, v, t, o, f, l)
#define _mtx_unlock_sleep(m, o, f, l) \
__mtx_unlock_sleep(&(m)->mtx_lock, o, f, l)
#else
#define _mtx_lock_sleep(m, v, t, o, f, l) \
__mtx_lock_sleep(&(m)->mtx_lock, v, t, o)
#define _mtx_unlock_sleep(m, o, f, l) \
__mtx_unlock_sleep(&(m)->mtx_lock, o)
#endif
#ifdef SMP
#define _mtx_lock_spin(m, v, t, o, f, l) \
_mtx_lock_spin_cookie(&(m)->mtx_lock, v, t, o, f, l)