From owner-svn-src-all@FreeBSD.ORG Mon Jan 16 04:39:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5FA2106564A; Mon, 16 Jan 2012 04:39:10 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A15678FC14; Mon, 16 Jan 2012 04:39:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0G4dA17015788; Mon, 16 Jan 2012 04:39:10 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0G4dAiL015786; Mon, 16 Jan 2012 04:39:10 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201201160439.q0G4dAiL015786@svn.freebsd.org> From: David Xu Date: Mon, 16 Jan 2012 04:39:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230194 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2012 04:39:10 -0000 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);