From owner-svn-src-all@FreeBSD.ORG Tue Oct 22 10:40:26 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C16E2D52; Tue, 22 Oct 2013 10:40:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AF79A2FE1; Tue, 22 Oct 2013 10:40:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MAeQeG006907; Tue, 22 Oct 2013 10:40:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MAeQ7G006906; Tue, 22 Oct 2013 10:40:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310221040.r9MAeQ7G006906@svn.freebsd.org> From: Alexander Motin Date: Tue, 22 Oct 2013 10:40:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256885 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Tue, 22 Oct 2013 10:40:26 -0000 Author: mav Date: Tue Oct 22 10:40:26 2013 New Revision: 256885 URL: http://svnweb.freebsd.org/changeset/base/256885 Log: Remove global device lock acquisition from dev_relthread(), replacing it with atomics on per-device data. Modified: head/sys/kern/kern_conf.c Modified: head/sys/kern/kern_conf.c ============================================================================== --- head/sys/kern/kern_conf.c Tue Oct 22 10:21:20 2013 (r256884) +++ head/sys/kern/kern_conf.c Tue Oct 22 10:40:26 2013 (r256885) @@ -193,7 +193,7 @@ dev_refthread(struct cdev *dev, int *ref if (csw != NULL) { cdp = cdev2priv(dev); if ((cdp->cdp_flags & CDP_SCHED_DTR) == 0) - dev->si_threadcount++; + atomic_add_long(&dev->si_threadcount, 1); else csw = NULL; } @@ -234,7 +234,7 @@ devvn_refthread(struct vnode *vp, struct if ((cdp->cdp_flags & CDP_SCHED_DTR) == 0) { csw = dev->si_devsw; if (csw != NULL) - dev->si_threadcount++; + atomic_add_long(&dev->si_threadcount, 1); } dev_unlock(); if (csw != NULL) { @@ -251,11 +251,9 @@ dev_relthread(struct cdev *dev, int ref) mtx_assert(&devmtx, MA_NOTOWNED); if (!ref) return; - dev_lock(); KASSERT(dev->si_threadcount > 0, ("%s threadcount is wrong", dev->si_name)); - dev->si_threadcount--; - dev_unlock(); + atomic_subtract_rel_long(&dev->si_threadcount, 1); } int