aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_sx.c
diff options
context:
space:
mode:
authorKip Macy <kmacy@FreeBSD.org>2007-04-04 00:01:05 +0000
committerKip Macy <kmacy@FreeBSD.org>2007-04-04 00:01:05 +0000
commite2bc106690f7ebbbb6862cb4a6620951dd8c07db (patch)
tree51655869ba3051ec215b0ac0571f94a647cd77c2 /sys/kern/kern_sx.c
parent41948c253033331920b856ba6d404f7412a3a617 (diff)
downloadsrc-e2bc106690f7ebbbb6862cb4a6620951dd8c07db.tar.gz
src-e2bc106690f7ebbbb6862cb4a6620951dd8c07db.zip
style fixes and make sure that the lock is treated as released in the sharers == 0 case
not that this is somewhat racy because a new sharer can come in while we're updating stats
Notes
Notes: svn path=/head/; revision=168332
Diffstat (limited to 'sys/kern/kern_sx.c')
-rw-r--r--sys/kern/kern_sx.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c
index a988d0e3ea88..ad52af0bd862 100644
--- a/sys/kern/kern_sx.c
+++ b/sys/kern/kern_sx.c
@@ -170,8 +170,7 @@ sx_init_flags(struct sx *sx, const char *description, int opts)
{
int flags;
- flags = LO_SLEEPABLE | LO_UPGRADABLE | LO_RECURSABLE;;
-
+ flags = LO_SLEEPABLE | LO_UPGRADABLE | LO_RECURSABLE;
if (opts & SX_DUPOK)
flags |= LO_DUPOK;
if (opts & SX_NOPROFILE)
@@ -274,6 +273,8 @@ _sx_sunlock(struct sx *sx, const char *file, int line)
curthread->td_locks--;
WITNESS_UNLOCK(&sx->lock_object, 0, file, line);
LOCK_LOG_LOCK("SUNLOCK", &sx->lock_object, 0, 0, file, line);
+ if (SX_SHARERS(x) == 0)
+ lock_profile_release_lock(&sx->lock_object);
__sx_sunlock(sx, file, line);
}
@@ -522,9 +523,9 @@ _sx_xlock_hard(struct sx *sx, uintptr_t tid, const char *file, int line)
__func__, sx);
}
- GIANT_RESTORE();
+ GIANT_RESTORE();
lock_profile_obtain_lock_success(&(sx)->lock_object, contested,
- waitstart, (file), (line));
+ waitstart, file, line);
}
/*