This appears to work.  No packet loss with vfs.numvnodes
at 32132, 16K PPS test with 1 million packets.

I'll run some additional tests bringing vfs.numvnodes
closer to kern.maxvnodes.

On Dec 22, 2007, at 2:03 AM, Kostik Belousov wrote:


As Bruce Evans noted, there is a vfs_msync() that do almost the same
traversal of the vnodes. It was missed in the previous patch. Try this one.

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 3c2e1ed..6515d6a 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -2967,7 +2967,9 @@ vfs_msync(struct mount *mp, int flags)
 {
        struct vnode *vp, *mvp;
        struct vm_object *obj;
+       int yield_count;

+       yield_count = 0;
        MNT_ILOCK(mp);
        MNT_VNODE_FOREACH(vp, mp, mvp) {
                VI_LOCK(vp);
@@ -2996,6 +2998,12 @@ vfs_msync(struct mount *mp, int flags)
                        MNT_ILOCK(mp);
                } else
                        VI_UNLOCK(vp);
+               if (yield_count++ == 500) {
+                       MNT_IUNLOCK(mp);
+                       yield_count = 0;
+                       uio_yield();
+                       MNT_ILOCK(mp);
+               }
        }
        MNT_IUNLOCK(mp);
 }
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index cbccc62..9e8b887 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1182,6 +1182,7 @@ ffs_sync(mp, waitfor, td)
        int secondary_accwrites;
        int softdep_deps;
        int softdep_accdeps;
+       int yield_count;
        struct bufobj *bo;

        fs = ump->um_fs;
@@ -1216,6 +1217,7 @@ loop:
        softdep_get_depcounts(mp, &softdep_deps, &softdep_accdeps);
        MNT_ILOCK(mp);

+       yield_count = 0;
        MNT_VNODE_FOREACH(vp, mp, mvp) {
                /*
                 * Depend on the mntvnode_slock to keep things stable enough
@@ -1233,6 +1235,12 @@ loop:
                    (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
                    vp->v_bufobj.bo_dirty.bv_cnt == 0)) {
                        VI_UNLOCK(vp);
+                       if (yield_count++ == 500) {
+                               MNT_IUNLOCK(mp);
+                               yield_count = 0;
+                               uio_yield();
+                               MNT_ILOCK(mp);
+                       }
                        continue;
                }
                MNT_IUNLOCK(mp);

_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to