locks: adjust loop limit check when waiting for readers
The check was for the exact value, but since the counter started being incremented by the number of readers it could have jumped over.
This commit is contained in:
parent
cde25ed4cd
commit
efa9f177f5
@ -516,7 +516,7 @@ __rw_rlock_hard(struct rwlock *rw, struct thread *td, uintptr_t v
|
||||
#endif
|
||||
KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread),
|
||||
"running");
|
||||
if (i != rowner_loops)
|
||||
if (i < rowner_loops)
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@ -995,7 +995,7 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOCK_FILE_LINE_ARG_DEF)
|
||||
#ifdef KDTRACE_HOOKS
|
||||
lda.spin_cnt += rowner_loops - i;
|
||||
#endif
|
||||
if (i != rowner_loops)
|
||||
if (i < rowner_loops)
|
||||
continue;
|
||||
sleep_reason = 2;
|
||||
}
|
||||
|
@ -671,7 +671,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LOCK_FILE_LINE_ARG_DEF)
|
||||
#endif
|
||||
KTR_STATE0(KTR_SCHED, "thread",
|
||||
sched_tdname(curthread), "running");
|
||||
if (i != asx_loops)
|
||||
if (i < asx_loops)
|
||||
continue;
|
||||
sleep_reason = 2;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user