summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 507df8a..7b66186 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -465,9 +465,7 @@ _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line)
*/
if (v == MTX_UNOWNED) {
turnstile_release(&m->mtx_object);
-#if defined(__i386__) || defined(__amd64__)
- ia32_pause();
-#endif
+ cpu_spinwait();
continue;
}
@@ -497,9 +495,7 @@ _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line)
!atomic_cmpset_ptr(&m->mtx_lock, (void *)v,
(void *)(v | MTX_CONTESTED))) {
turnstile_release(&m->mtx_object);
-#if defined(__i386__) || defined(__amd64__)
- ia32_pause();
-#endif
+ cpu_spinwait();
continue;
}
@@ -516,9 +512,7 @@ _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line)
#endif
turnstile_release(&m->mtx_object);
while (mtx_owner(m) == owner && TD_IS_RUNNING(owner)) {
-#if defined(__i386__) || defined(__amd64__)
- ia32_pause();
-#endif
+ cpu_spinwait();
}
continue;
}
@@ -583,9 +577,7 @@ _mtx_lock_spin(struct mtx *m, int opts, const char *file, int line)
critical_exit();
while (m->mtx_lock != MTX_UNOWNED) {
if (i++ < 10000000) {
-#if defined(__i386__) || defined(__amd64__)
- ia32_pause();
-#endif
+ cpu_spinwait();
continue;
}
if (i < 60000000)
@@ -599,9 +591,7 @@ _mtx_lock_spin(struct mtx *m, int opts, const char *file, int line)
#endif
panic("spin lock held too long");
}
-#if defined(__i386__) || defined(__amd64__)
- ia32_pause();
-#endif
+ cpu_spinwait();
}
critical_enter();
}
OpenPOWER on IntegriCloud