Date: Fri, 17 Feb 2017 15:34:40 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r313877 - in head/sys: kern sys Message-ID: <201702171534.v1HFYeSj074747@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Fri Feb 17 15:34:40 2017 New Revision: 313877 URL: https://svnweb.freebsd.org/changeset/base/313877 Log: mtx: restrict r313875 to kernels without LOCK_PROFILING Modified: head/sys/kern/kern_mutex.c head/sys/sys/mutex.h Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Fri Feb 17 15:00:13 2017 (r313876) +++ head/sys/kern/kern_mutex.c Fri Feb 17 15:34:40 2017 (r313877) @@ -423,9 +423,14 @@ _mtx_trylock_flags_(volatile uintptr_t * * 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, "_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, struc * 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; Modified: head/sys/sys/mutex.h ============================================================================== --- head/sys/sys/mutex.h Fri Feb 17 15:00:13 2017 (r313876) +++ head/sys/sys/mutex.h Fri Feb 17 15:34:40 2017 (r313877) @@ -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 *, _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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702171534.v1HFYeSj074747>