summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-04-14 19:51:50 +0000
committerjhb <jhb@FreeBSD.org>2006-04-14 19:51:50 +0000
commitb15516d82476924902c9d5c2b81e7fbbd852f488 (patch)
tree60065c0baa090eb5c3d4da2678c940b19f4df51b /sys/kern/kern_mutex.c
parent8dfa3f148319713c64ea725c5ab70ae27bcd5a79 (diff)
downloadFreeBSD-src-b15516d82476924902c9d5c2b81e7fbbd852f488.zip
FreeBSD-src-b15516d82476924902c9d5c2b81e7fbbd852f488.tar.gz
Mark the thread pointer used during an adaptive spin volatile so that the
compiler doesn't decide to cache td_state. Cachine the state would cause the spinning thread to not notice when the owning thread stopped executing (if it was preempted for example) which could result in livelock.
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 2b275d0..be228d6 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -449,7 +449,7 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t tid, int opts, const char *file,
int line)
{
#if defined(SMP) && !defined(NO_ADAPTIVE_MUTEXES)
- struct thread *owner;
+ volatile struct thread *owner;
#endif
uintptr_t v;
#ifdef KTR
OpenPOWER on IntegriCloud