1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-02-02 17:08:56 +00:00

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:
John Baldwin 2000-11-29 18:41:19 +00:00
parent 8f838cb563
commit f404050e44
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=69363
3 changed files with 6 additions and 3 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;