svn commit: r327402 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Sun Dec 31 02:31:03 UTC 2017
Author: mjg
Date: Sun Dec 31 02:31:01 2017
New Revision: 327402
URL: https://svnweb.freebsd.org/changeset/base/327402
Log:
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.
Modified:
head/sys/kern/kern_rwlock.c
head/sys/kern/kern_sx.c
Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c Sun Dec 31 01:59:56 2017 (r327401)
+++ head/sys/kern/kern_rwlock.c Sun Dec 31 02:31:01 2017 (r327402)
@@ -516,7 +516,7 @@ __rw_rlock_hard(struct rwlock *rw, struct thread *td,
#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 LOC
#ifdef KDTRACE_HOOKS
lda.spin_cnt += rowner_loops - i;
#endif
- if (i != rowner_loops)
+ if (i < rowner_loops)
continue;
sleep_reason = 2;
}
Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c Sun Dec 31 01:59:56 2017 (r327401)
+++ head/sys/kern/kern_sx.c Sun Dec 31 02:31:01 2017 (r327402)
@@ -671,7 +671,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
#endif
KTR_STATE0(KTR_SCHED, "thread",
sched_tdname(curthread), "running");
- if (i != asx_loops)
+ if (i < asx_loops)
continue;
sleep_reason = 2;
}
More information about the svn-src-all
mailing list