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.
This commit is contained in:
parent
8f838cb563
commit
f404050e44
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user