Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Dec 2007 13:23:22 -0500
From:      Mark Fullmer <maf@splintered.net>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-net@freebsd.org, freebsd-stable@freebsd.org
Subject:   Re: Packet loss every 30.999 seconds
Message-ID:  <D0623780-E342-4083-8309-412163A22FB2@splintered.net>
In-Reply-To: <20071222070318.GT57756@deviant.kiev.zoral.com.ua>
References:  <20071217102433.GQ25053@tnn.dglawrence.com> <CD187AD1-8712-418F-9F49-FA3407BA1AC7@eng.oar.net> <20071220011626.U928@besplex.bde.org> <814DB7A9-E64F-4BCA-A502-AB5A6E0297D3@eng.oar.net> <20071219171331.GH25053@tnn.dglawrence.com> <20071221200810.GY16982@elvis.mu.org> <20071221234347.GS25053@tnn.dglawrence.com> <6D374B4C-0D98-4916-A762-7A85912B3058@splintered.net> <20071222053648.GQ57756@deviant.kiev.zoral.com.ua> <3647BB78-BA10-432B-A52B-04E402E155CC@splintered.net> <20071222070318.GT57756@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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);




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D0623780-E342-4083-8309-412163A22FB2>