let umtxq_busy() only spin on mp machine. make function name
do_rwlock_unlock to be consistent with others.
This commit is contained in:
parent
61f3d0ccf7
commit
44253336b6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177880
@ -324,14 +324,18 @@ umtxq_busy(struct umtx_key *key)
|
|||||||
uc = umtxq_getchain(key);
|
uc = umtxq_getchain(key);
|
||||||
mtx_assert(&uc->uc_lock, MA_OWNED);
|
mtx_assert(&uc->uc_lock, MA_OWNED);
|
||||||
if (uc->uc_busy) {
|
if (uc->uc_busy) {
|
||||||
int count = BUSY_SPINS;
|
#ifdef SMP
|
||||||
if (count > 0) {
|
if (smp_cpus > 1) {
|
||||||
umtxq_unlock(key);
|
int count = BUSY_SPINS;
|
||||||
while (uc->uc_busy && --count > 0)
|
if (count > 0) {
|
||||||
cpu_spinwait();
|
umtxq_unlock(key);
|
||||||
umtxq_lock(key);
|
while (uc->uc_busy && --count > 0)
|
||||||
|
cpu_spinwait();
|
||||||
|
umtxq_lock(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (uc->uc_busy != 0) {
|
#endif
|
||||||
|
while (uc->uc_busy) {
|
||||||
uc->uc_waiters++;
|
uc->uc_waiters++;
|
||||||
msleep(uc, &uc->uc_lock, 0, "umtxqb", 0);
|
msleep(uc, &uc->uc_lock, 0, "umtxqb", 0);
|
||||||
uc->uc_waiters--;
|
uc->uc_waiters--;
|
||||||
@ -2604,7 +2608,7 @@ do_rw_wrlock2(struct thread *td, void *obj, struct timespec *timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_rwlock_unlock(struct thread *td, struct urwlock *rwlock)
|
do_rw_unlock(struct thread *td, struct urwlock *rwlock)
|
||||||
{
|
{
|
||||||
struct umtx_q *uq;
|
struct umtx_q *uq;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
@ -2896,7 +2900,7 @@ __umtx_op_rw_wrlock(struct thread *td, struct _umtx_op_args *uap)
|
|||||||
static int
|
static int
|
||||||
__umtx_op_rw_unlock(struct thread *td, struct _umtx_op_args *uap)
|
__umtx_op_rw_unlock(struct thread *td, struct _umtx_op_args *uap)
|
||||||
{
|
{
|
||||||
return do_rwlock_unlock(td, uap->obj);
|
return do_rw_unlock(td, uap->obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef int (*_umtx_op_func)(struct thread *td, struct _umtx_op_args *uap);
|
typedef int (*_umtx_op_func)(struct thread *td, struct _umtx_op_args *uap);
|
||||||
|
Loading…
Reference in New Issue
Block a user