diff options
author | John Baldwin <jhb@FreeBSD.org> | 2009-05-29 14:03:34 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2009-05-29 14:03:34 +0000 |
commit | a571ad41ae9c218e7c66e494d64d4281baa5fa06 (patch) | |
tree | 7e9c09c962ce8c51b7ba4cd086e5c5c53707cada | |
parent | fa29f0236f125315259dd8e132ce087233d06dbd (diff) | |
download | src-a571ad41ae9c218e7c66e494d64d4281baa5fa06.tar.gz src-a571ad41ae9c218e7c66e494d64d4281baa5fa06.zip |
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
Notes
Notes:
svn path=/head/; revision=193037
-rw-r--r-- | sys/kern/kern_mutex.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_rwlock.c | 8 |
2 files changed, 0 insertions, 11 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index 17c72eb8ef25..fc342c53ef4b 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -393,7 +393,6 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t tid, int opts, const char *file, */ if (v == MTX_UNOWNED) { turnstile_cancel(ts); - cpu_spinwait(); continue; } @@ -408,7 +407,6 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t tid, int opts, const char *file, 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 tid, int opts, const char *file, if ((v & MTX_CONTESTED) == 0 && !atomic_cmpset_ptr(&m->mtx_lock, v, v | MTX_CONTESTED)) { turnstile_cancel(ts); - cpu_spinwait(); continue; } diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index cc5f4f132f08..28fccceb62ba 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -350,7 +350,6 @@ _rw_rlock(struct rwlock *rw, const char *file, int line) (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 *file, int line) 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 *file, int line) 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 *file, int line) 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, uintptr_t tid, const char *file, int line) 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, uintptr_t tid, const char *file, int line) 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, uintptr_t tid, const char *file, int line) break; } turnstile_cancel(ts); - cpu_spinwait(); continue; } /* @@ -762,7 +755,6 @@ _rw_wlock_hard(struct rwlock *rw, uintptr_t tid, const char *file, int line) 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)) |