Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Dec 2007 09:03:18 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Mark Fullmer <maf@splintered.net>
Cc:        freebsd-net@freebsd.org, freebsd-stable@freebsd.org
Subject:   Re: Packet loss every 30.999 seconds
Message-ID:  <20071222070318.GT57756@deviant.kiev.zoral.com.ua>
In-Reply-To: <3647BB78-BA10-432B-A52B-04E402E155CC@splintered.net>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

--N7HXVILz59yg1nI8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Dec 22, 2007 at 01:28:31AM -0500, Mark Fullmer wrote:
>=20
> On Dec 22, 2007, at 12:36 AM, Kostik Belousov wrote:
> >Lets check whether the syncer is the culprit for you.
> >Please, change the value of the syncdelay at the sys/kern/vfs_subr.c
> >around the line 238 from 30 to some other value, e.g., 45. After that,
> >check the interval of the effect you have observed.
>=20
> Changed it to 13.  Not sure if SYNCER_MAXDELAY also needed to be
> increased if syncdelay was increased.
>=20
> static int syncdelay =3D 13;              /* max time to delay syncing =
=20
> data */
>=20
> Test:
>=20
> ; use vnodes
> % find / -type f -print > /dev/null
>=20
> ; verify
> % sysctl vfs.numvnodes
> vfs.numvnodes: 32128
>=20
> ; run packet loss test
> now have periodic loss every 13994633us (13.99 seconds).
>=20
> ; reduce # of vnodes with sysctl kern.maxvnodes=3D1000
> test now runs clean.
Definitely syncer.=20

> >
> >It would be interesting to check whether completely disabling the =20
> >syncer
> >eliminates the packet loss, but such system have to be operated with
> >extreme caution.
Ok, no need to do this.

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;
=20
+	yield_count =3D 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++ =3D=3D 500) {
+			MNT_IUNLOCK(mp);
+			yield_count =3D 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;
=20
 	fs =3D ump->um_fs;
@@ -1216,6 +1217,7 @@ loop:
 	softdep_get_depcounts(mp, &softdep_deps, &softdep_accdeps);
 	MNT_ILOCK(mp);
=20
+	yield_count =3D 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)) =3D=3D 0 &&
 		    vp->v_bufobj.bo_dirty.bv_cnt =3D=3D 0)) {
 			VI_UNLOCK(vp);
+			if (yield_count++ =3D=3D 500) {
+				MNT_IUNLOCK(mp);
+				yield_count =3D 0;
+				uio_yield();
+				MNT_ILOCK(mp);
+			}
 			continue;
 		}
 		MNT_IUNLOCK(mp);

--N7HXVILz59yg1nI8
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFHbLa1C3+MBN1Mb4gRAjZAAKDOZCUCmfjbFX61IvwpSDfMg8dTCgCgqxLE
LsxaM+dv/WP5wHW2z1lYJZ8=
=yi5I
-----END PGP SIGNATURE-----

--N7HXVILz59yg1nI8--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071222070318.GT57756>