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...
This commit is contained in:
Peter Wemm 1998-04-18 06:26:16 +00:00
parent 141d52a900
commit 37b8ccd37a
2 changed files with 20 additions and 6 deletions

View File

@ -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);

View File

@ -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);