diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -501,9 +501,7 @@ if (error != 0) break; - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); /* * Set the contested bit so that a release in user space knows @@ -642,9 +640,7 @@ umtx_key_release(&key); return (error); } - umtxq_lock(&key); - umtxq_busy(&key); - umtxq_unlock(&key); + umtxq_busy_unlocked(&key); error = futex_atomic_op(td, args->val3, args->uaddr2, &op_ret); umtxq_lock(&key); umtxq_unbusy(&key); @@ -701,9 +697,7 @@ umtx_key_release(&key); return (error); } - umtxq_lock(&key); - umtxq_busy(&key); - umtxq_unlock(&key); + umtxq_busy_unlocked(&key); error = fueword32(args->uaddr, &uval); if (error != 0) error = EFAULT; diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -441,9 +441,16 @@ } void -umtxq_unbusy_unlocked(struct umtx_key *key) +umtxq_busy_unlocked(struct umtx_key *key) { + umtxq_lock(key); + umtxq_busy(key); + umtxq_unlock(key); +} +void +umtxq_unbusy_unlocked(struct umtx_key *key) +{ umtxq_lock(key); umtxq_unbusy(key); umtxq_unlock(key); @@ -2372,9 +2379,7 @@ if (error != 0) break; - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); /* * Set the contested bit so that a release in user space @@ -2540,9 +2545,7 @@ su = (priv_check(td, PRIV_SCHED_RTPRIO) == 0); for (;;) { old_inherited_pri = uq->uq_inherited_pri; - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); rv = fueword32(&m->m_ceilings[0], &ceiling); if (rv == -1) { @@ -2727,9 +2730,8 @@ TYPE_PP_ROBUST_UMUTEX : TYPE_PP_UMUTEX, GET_SHARE(flags), &key)) != 0) return (error); - umtxq_lock(&key); - umtxq_busy(&key); - umtxq_unlock(&key); + umtxq_busy_unlocked(&key); + /* * For priority protected mutex, always set unlocked state * to UMUTEX_CONTESTED, so that userland always enters kernel @@ -2792,9 +2794,7 @@ &uq->uq_key)) != 0) return (error); for (;;) { - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); rv = fueword32(&m->m_ceilings[0], &save_ceiling); if (rv == -1) { @@ -3148,9 +3148,7 @@ break; /* grab monitor lock */ - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); /* * re-read the state, in case it changed between the try-lock above @@ -3341,9 +3339,7 @@ } /* grab monitor lock */ - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); /* * Re-read the state, in case it changed between the diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h --- a/sys/sys/umtxvar.h +++ b/sys/sys/umtxvar.h @@ -206,6 +206,7 @@ void umtx_key_release(struct umtx_key *); struct umtx_q *umtxq_alloc(void); void umtxq_busy(struct umtx_key *); +void umtxq_busy_unlocked(struct umtx_key *); int umtxq_count(struct umtx_key *); void umtxq_free(struct umtx_q *); struct umtxq_chain *umtxq_getchain(struct umtx_key *);