summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-04-18 06:26:16 +0000
committerpeter <peter@FreeBSD.org>1998-04-18 06:26:16 +0000
commitbbf574dac9bac884a45d3fbd7f1b2ee9a74903ef (patch)
tree2d269de2a79af5dc637172467135a4857e29c592
parent73c489feda99a875404deaa2730fd3978496c38f (diff)
downloadFreeBSD-src-bbf574dac9bac884a45d3fbd7f1b2ee9a74903ef.zip
FreeBSD-src-bbf574dac9bac884a45d3fbd7f1b2ee9a74903ef.tar.gz
In vfs_msync(), test to see if the vnode being examined is "interesting"
(ie: it has a vm_object attached and is marked as OBJ_MIGHTBEDIRTY) before attempting to lock it. This should reduce the cpu hit that is incurred when doing a sync(2) and when the syncer process is doing the 30-second writeback of dirty mmap() data to disk. Skip this speedup if we are doing an unmount() to be sure to get everything - we can afford to occasionally miss a msync while the system is running, but not at unmount. I'm not sure about the VXLOCK and MNT_WAIT case, it seems a bit odd to skip doing a page_clean at unmount time just because a vnode is VXLOCKed, but that's what was being done before...
-rw-r--r--sys/kern/vfs_export.c13
-rw-r--r--sys/kern/vfs_subr.c13
2 files changed, 20 insertions, 6 deletions
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index 2950d85..8e6c9dc 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
- * $Id: vfs_subr.c,v 1.149 1998/04/15 18:37:49 tegge Exp $
+ * $Id: vfs_subr.c,v 1.150 1998/04/16 03:31:26 peter Exp $
*/
/*
@@ -2404,6 +2404,7 @@ vfs_export_lookup(mp, nep, nam)
void
vfs_msync(struct mount *mp, int flags) {
struct vnode *vp, *nvp;
+ struct vm_object *obj;
int anyio, tries;
tries = 5;
@@ -2417,9 +2418,15 @@ loop:
goto loop;
}
- if ((vp->v_flag & VXLOCK) ||
- (VOP_ISLOCKED(vp) && (flags != MNT_WAIT))) {
+ if (vp->v_flag & VXLOCK) /* XXX: what if MNT_WAIT? */
continue;
+
+ if (flags != MNT_WAIT) {
+ obj = vp->v_object;
+ if (obj == NULL || (obj->flags & OBJ_MIGHTBEDIRTY) == 0)
+ continue;
+ if (VOP_ISLOCKED(vp))
+ continue;
}
simple_lock(&vp->v_interlock);
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 2950d85..8e6c9dc 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
- * $Id: vfs_subr.c,v 1.149 1998/04/15 18:37:49 tegge Exp $
+ * $Id: vfs_subr.c,v 1.150 1998/04/16 03:31:26 peter Exp $
*/
/*
@@ -2404,6 +2404,7 @@ vfs_export_lookup(mp, nep, nam)
void
vfs_msync(struct mount *mp, int flags) {
struct vnode *vp, *nvp;
+ struct vm_object *obj;
int anyio, tries;
tries = 5;
@@ -2417,9 +2418,15 @@ loop:
goto loop;
}
- if ((vp->v_flag & VXLOCK) ||
- (VOP_ISLOCKED(vp) && (flags != MNT_WAIT))) {
+ if (vp->v_flag & VXLOCK) /* XXX: what if MNT_WAIT? */
continue;
+
+ if (flags != MNT_WAIT) {
+ obj = vp->v_object;
+ if (obj == NULL || (obj->flags & OBJ_MIGHTBEDIRTY) == 0)
+ continue;
+ if (VOP_ISLOCKED(vp))
+ continue;
}
simple_lock(&vp->v_interlock);
OpenPOWER on IntegriCloud