Date: Sun, 31 Dec 2017 02:31:01 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327402 - head/sys/kern Message-ID: <201712310231.vBV2V1Jr069222@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712310231.vBV2V1Jr069222>