Date: Mon, 16 Jan 2012 04:39:10 +0000 (UTC) From: David Xu <davidxu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r230194 - head/sys/kern Message-ID: <201201160439.q0G4dAiL015786@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: davidxu Date: Mon Jan 16 04:39:10 2012 New Revision: 230194 URL: http://svn.freebsd.org/changeset/base/230194 Log: Eliminate branch and insert an explicit reader memory barrier to ensure that waiter bit is set before reading semaphore count. Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Mon Jan 16 04:09:45 2012 (r230193) +++ head/sys/kern/kern_umtx.c Mon Jan 16 04:39:10 2012 (r230194) @@ -2804,9 +2804,8 @@ do_sem_wait(struct thread *td, struct _u umtxq_insert(uq); umtxq_unlock(&uq->uq_key); - if (fuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters)) == 0) - casuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 0, 1); - + casuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 0, 1); + rmb(); count = fuword32(__DEVOLATILE(uint32_t *, &sem->_count)); if (count != 0) { umtxq_lock(&uq->uq_key);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201160439.q0G4dAiL015786>