svn commit: r193035 - head/sys/kern
John Baldwin
jhb at FreeBSD.org
Fri May 29 13:56:36 UTC 2009
Author: jhb
Date: Fri May 29 13:56:34 2009
New Revision: 193035
URL: http://svn.freebsd.org/changeset/base/193035
Log:
Tweak a few comments on adaptive spinning.
Modified:
head/sys/kern/kern_mutex.c
head/sys/kern/kern_rwlock.c
Modified: head/sys/kern/kern_mutex.c
==============================================================================
--- head/sys/kern/kern_mutex.c Fri May 29 13:48:42 2009 (r193034)
+++ head/sys/kern/kern_mutex.c Fri May 29 13:56:34 2009 (r193035)
@@ -399,8 +399,11 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t
#ifdef ADAPTIVE_MUTEXES
/*
- * If the current owner of the lock is executing on another
- * CPU quit the hard path and try to spin.
+ * The current lock owner might have started executing
+ * on another CPU (or the lock could have changed
+ * owners) while we were waiting on the turnstile
+ * chain lock. If so, drop the turnstile lock and try
+ * again.
*/
owner = (struct thread *)(v & ~MTX_FLAGMASK);
if (TD_IS_RUNNING(owner)) {
Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c Fri May 29 13:48:42 2009 (r193034)
+++ head/sys/kern/kern_rwlock.c Fri May 29 13:56:34 2009 (r193035)
@@ -412,8 +412,11 @@ _rw_rlock(struct rwlock *rw, const char
#ifdef ADAPTIVE_RWLOCKS
/*
- * If the current owner of the lock is executing on another
- * CPU quit the hard path and try to spin.
+ * The current lock owner might have started executing
+ * on another CPU (or the lock could have changed
+ * owners) while we were waiting on the turnstile
+ * chain lock. If so, drop the turnstile lock and try
+ * again.
*/
if ((v & RW_LOCK_READ) == 0) {
owner = (struct thread *)RW_OWNER(v);
@@ -714,8 +717,11 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
#ifdef ADAPTIVE_RWLOCKS
/*
- * If the current owner of the lock is executing on another
- * CPU quit the hard path and try to spin.
+ * The current lock owner might have started executing
+ * on another CPU (or the lock could have changed
+ * owners) while we were waiting on the turnstile
+ * chain lock. If so, drop the turnstile lock and try
+ * again.
*/
if (!(v & RW_LOCK_READ)) {
owner = (struct thread *)RW_OWNER(v);
More information about the svn-src-all
mailing list