aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/sx.h
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2015-07-19 22:24:33 +0000
committerMark Johnston <markj@FreeBSD.org>2015-07-19 22:24:33 +0000
commitde2c95cc007982be33371947aade23e3b045776d (patch)
tree00df546498905346ad09c126f134fd80edbd7479 /sys/sys/sx.h
parent32cd0147fafec2d3d2817d733fa70bad9cdf34ce (diff)
downloadsrc-de2c95cc007982be33371947aade23e3b045776d.tar.gz
src-de2c95cc007982be33371947aade23e3b045776d.zip
Consistently use a reader/writer flag for lockstat probes in rwlock(9) and
sx(9), rather than using the probe function name to determine whether a given lock is a read lock or a write lock. Update lockstat(1) accordingly.
Notes
Notes: svn path=/head/; revision=285704
Diffstat (limited to 'sys/sys/sx.h')
-rw-r--r--sys/sys/sx.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/sys/sx.h b/sys/sys/sx.h
index c01735c75f51..96a664f35e52 100644
--- a/sys/sys/sx.h
+++ b/sys/sys/sx.h
@@ -153,8 +153,8 @@ __sx_xlock(struct sx *sx, struct thread *td, int opts, const char *file,
if (!atomic_cmpset_acq_ptr(&sx->sx_lock, SX_LOCK_UNLOCKED, tid))
error = _sx_xlock_hard(sx, tid, opts, file, line);
else
- LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(sx__acquire, sx,
- 0, 0, file, line);
+ LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(sx__acquire, sx,
+ 0, 0, file, line, LOCKSTAT_WRITER);
return (error);
}
@@ -166,7 +166,8 @@ __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line)
uintptr_t tid = (uintptr_t)td;
if (sx->sx_recurse == 0)
- LOCKSTAT_PROFILE_RELEASE_LOCK(sx__release, sx);
+ LOCKSTAT_PROFILE_RELEASE_RWLOCK(sx__release, sx,
+ LOCKSTAT_WRITER);
if (!atomic_cmpset_rel_ptr(&sx->sx_lock, tid, SX_LOCK_UNLOCKED))
_sx_xunlock_hard(sx, tid, file, line);
}
@@ -182,8 +183,8 @@ __sx_slock(struct sx *sx, int opts, const char *file, int line)
!atomic_cmpset_acq_ptr(&sx->sx_lock, x, x + SX_ONE_SHARER))
error = _sx_slock_hard(sx, opts, file, line);
else
- LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(sx__acquire, sx,
- 0, 0, file, line);
+ LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(sx__acquire, sx,
+ 0, 0, file, line, LOCKSTAT_READER);
return (error);
}
@@ -200,7 +201,7 @@ __sx_sunlock(struct sx *sx, const char *file, int line)
{
uintptr_t x = sx->sx_lock;
- LOCKSTAT_PROFILE_RELEASE_LOCK(sx__release, sx);
+ LOCKSTAT_PROFILE_RELEASE_RWLOCK(sx__release, sx, LOCKSTAT_READER);
if (x == (SX_SHARERS_LOCK(1) | SX_LOCK_EXCLUSIVE_WAITERS) ||
!atomic_cmpset_rel_ptr(&sx->sx_lock, x, x - SX_ONE_SHARER))
_sx_sunlock_hard(sx, file, line);