diff options
author | jhb <jhb@FreeBSD.org> | 2006-04-14 19:51:50 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-04-14 19:51:50 +0000 |
commit | b15516d82476924902c9d5c2b81e7fbbd852f488 (patch) | |
tree | 60065c0baa090eb5c3d4da2678c940b19f4df51b /sys/kern | |
parent | 8dfa3f148319713c64ea725c5ab70ae27bcd5a79 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/kern/kern_mutex.c | 2 |
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 |