svn commit: r193037 - head/sys/kern
John Baldwin
jhb at FreeBSD.org
Fri May 29 14:03:35 UTC 2009
Author: jhb
Date: Fri May 29 14:03:34 2009
New Revision: 193037
URL: http://svn.freebsd.org/changeset/base/193037
Log:
Remove extra cpu_spinwait() invocations. This should really only be used
in tight spin loops, not in these edge cases where we restart a much
larger loop only a few times.
Reviewed by: attilio
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 14:02:45 2009 (r193036)
+++ head/sys/kern/kern_mutex.c Fri May 29 14:03:34 2009 (r193037)
@@ -393,7 +393,6 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t
*/
if (v == MTX_UNOWNED) {
turnstile_cancel(ts);
- cpu_spinwait();
continue;
}
@@ -408,7 +407,6 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t
owner = (struct thread *)(v & ~MTX_FLAGMASK);
if (TD_IS_RUNNING(owner)) {
turnstile_cancel(ts);
- cpu_spinwait();
continue;
}
#endif
@@ -421,7 +419,6 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t
if ((v & MTX_CONTESTED) == 0 &&
!atomic_cmpset_ptr(&m->mtx_lock, v, v | MTX_CONTESTED)) {
turnstile_cancel(ts);
- cpu_spinwait();
continue;
}
Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c Fri May 29 14:02:45 2009 (r193036)
+++ head/sys/kern/kern_rwlock.c Fri May 29 14:03:34 2009 (r193037)
@@ -350,7 +350,6 @@ _rw_rlock(struct rwlock *rw, const char
(void *)(v + RW_ONE_READER));
break;
}
- cpu_spinwait();
continue;
}
lock_profile_obtain_lock_failed(&rw->lock_object,
@@ -406,7 +405,6 @@ _rw_rlock(struct rwlock *rw, const char
v = rw->rw_lock;
if (RW_CAN_READ(v)) {
turnstile_cancel(ts);
- cpu_spinwait();
continue;
}
@@ -422,7 +420,6 @@ _rw_rlock(struct rwlock *rw, const char
owner = (struct thread *)RW_OWNER(v);
if (TD_IS_RUNNING(owner)) {
turnstile_cancel(ts);
- cpu_spinwait();
continue;
}
}
@@ -443,7 +440,6 @@ _rw_rlock(struct rwlock *rw, const char
if (!atomic_cmpset_ptr(&rw->rw_lock, v,
v | RW_LOCK_READ_WAITERS)) {
turnstile_cancel(ts);
- cpu_spinwait();
continue;
}
if (LOCK_LOG_TEST(&rw->lock_object, 0))
@@ -695,7 +691,6 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
if (!(v & RW_LOCK_WRITE_SPINNER)) {
if (!atomic_cmpset_ptr(&rw->rw_lock, v,
v | RW_LOCK_WRITE_SPINNER)) {
- cpu_spinwait();
continue;
}
}
@@ -727,7 +722,6 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
owner = (struct thread *)RW_OWNER(v);
if (TD_IS_RUNNING(owner)) {
turnstile_cancel(ts);
- cpu_spinwait();
continue;
}
}
@@ -750,7 +744,6 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
break;
}
turnstile_cancel(ts);
- cpu_spinwait();
continue;
}
/*
@@ -762,7 +755,6 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
if (!atomic_cmpset_ptr(&rw->rw_lock, v,
v | RW_LOCK_WRITE_WAITERS)) {
turnstile_cancel(ts);
- cpu_spinwait();
continue;
}
if (LOCK_LOG_TEST(&rw->lock_object, 0))
More information about the svn-src-head
mailing list