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:
Mateusz Guzik 2017-12-31 02:31:01 +00:00
parent cde25ed4cd
commit efa9f177f5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327402
2 changed files with 3 additions and 3 deletions

View File

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

View File

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