aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_conf.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2013-10-22 10:40:26 +0000
committerAlexander Motin <mav@FreeBSD.org>2013-10-22 10:40:26 +0000
commit9e8bd2acf28e7e508ffbe9004552f009adff0e73 (patch)
tree3fa620f630c326ab9ef6341947f563667c660dc0 /sys/kern/kern_conf.c
parent1a29adad308f038993a1ada87138e1fdc93c5ddd (diff)
downloadsrc-9e8bd2acf28e7e508ffbe9004552f009adff0e73.tar.gz
src-9e8bd2acf28e7e508ffbe9004552f009adff0e73.zip
Remove global device lock acquisition from dev_relthread(), replacing it
with atomics on per-device data.
Notes
Notes: svn path=/head/; revision=256885
Diffstat (limited to 'sys/kern/kern_conf.c')
-rw-r--r--sys/kern/kern_conf.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index c04d1da7f5fa..b1ae7a16ceab 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -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 cdev **devp, int *ref)
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