summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-11-29 18:41:19 +0000
committerjhb <jhb@FreeBSD.org>2000-11-29 18:41:19 +0000
commit0640108ef5eaf64e213692ca07bbdebf5c080ec7 (patch)
tree279c1ebe9a0dac7e8e1db06714f42de5d311b7d6 /sys/kern/kern_mutex.c
parent42af0b6bb4a972d1a9696148a4a12dfe0a3ad03a (diff)
downloadFreeBSD-src-0640108ef5eaf64e213692ca07bbdebf5c080ec7.zip
FreeBSD-src-0640108ef5eaf64e213692ca07bbdebf5c080ec7.tar.gz
Use an atomic operation with an appropriate memory barrier when releasing
a contested sleep mutex in the case that at least two processes are blocked on the contested mutex.
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 1a4dda2..a58311e 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -405,7 +405,8 @@ mtx_exit_hard(struct mtx *m, int type)
_release_lock_quick(m);
CTR1(KTR_LOCK, "mtx_exit: 0x%p not held", m);
} else
- m->mtx_lock = MTX_CONTESTED;
+ atomic_store_rel_ptr(&m->mtx_lock,
+ (void *)MTX_CONTESTED);
pri = MAXPRI;
LIST_FOREACH(m1, &p->p_contested, mtx_contested) {
int cp = TAILQ_FIRST(&m1->mtx_blocked)->p_priority;
OpenPOWER on IntegriCloud