aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2006-04-14 19:51:50 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2006-04-14 19:51:50 +0000
commit76447e561824098fac205f10fbbacf1f1a13c81c (patch)
tree60065c0baa090eb5c3d4da2678c940b19f4df51b
parent1427d59beef1c498aca96589ea214e767fe76e70 (diff)
downloadsrc-76447e561824098fac205f10fbbacf1f1a13c81c.tar.gz
src-76447e561824098fac205f10fbbacf1f1a13c81c.zip
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.
Notes
Notes: svn path=/head/; revision=157763
-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 2b275d034417..be228d61b738 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