Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jan 2014 23:02:03 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r260356 - stable/10/sys/kern
Message-ID:  <201401052302.s05N23WY022828@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Jan  5 23:02:03 2014
New Revision: 260356
URL: http://svnweb.freebsd.org/changeset/base/260356

Log:
  MFC r256885:
  Remove global device lock acquisition from dev_relthread(), replacing it
  with atomics on per-device data.

Modified:
  stable/10/sys/kern/kern_conf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_conf.c
==============================================================================
--- stable/10/sys/kern/kern_conf.c	Sun Jan  5 23:01:28 2014	(r260355)
+++ stable/10/sys/kern/kern_conf.c	Sun Jan  5 23:02:03 2014	(r260356)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401052302.s05N23WY022828>