From owner-freebsd-net@FreeBSD.ORG Wed Dec 19 18:24:54 2007 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F62D16A417; Wed, 19 Dec 2007 18:24:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id E2AC713C45D; Wed, 19 Dec 2007 18:24:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [212.82.216.226] (helo=deviant.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1J53bA-0008x5-5b; Wed, 19 Dec 2007 20:24:52 +0200 Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id lBJIOn83006616; Wed, 19 Dec 2007 20:24:49 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id lBJIOmJ3006615; Wed, 19 Dec 2007 20:24:48 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 19 Dec 2007 20:24:48 +0200 From: Kostik Belousov To: David G Lawrence Message-ID: <20071219182448.GD57756@deviant.kiev.zoral.com.ua> References: <20071217102433.GQ25053@tnn.dglawrence.com> <20071220011626.U928@besplex.bde.org> <814DB7A9-E64F-4BCA-A502-AB5A6E0297D3@eng.oar.net> <20071219171331.GH25053@tnn.dglawrence.com> <20071219181158.GC57756@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wULyF7TL5taEdwHz" Content-Disposition: inline In-Reply-To: <20071219181158.GC57756@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-Scanner-Signature: c743d2f542030c7d5376417eb66b5b31 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Info: Profiles 1929 [Dec 19 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {received from trusted relay: not dialup} X-SpamTest-Method: none X-SpamTest-Method: Local Lists X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: freebsd-net@freebsd.org, freebsd-stable@freebsd.org Subject: Re: Packet loss every 30.999 seconds X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2007 18:24:54 -0000 --wULyF7TL5taEdwHz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 19, 2007 at 08:11:59PM +0200, Kostik Belousov wrote: > On Wed, Dec 19, 2007 at 09:13:31AM -0800, David G Lawrence wrote: > > > >Try it with "find / -type f >/dev/null" to duplicate the problem =20 > > > >almost > > > >instantly. > > >=20 > > > I was able to verify last night that (cd /; tar -cpf -) > all.tar wou= ld > > > trigger the problem. I'm working getting a test running with > > > David's ffs_sync() workaround now, adding a few counters there should > > > get this narrowed down a little more. > >=20 > > Unfortunately, the version of the patch that I sent out isn't going = to > > help your problem. It needs to yield at the top of the loop, but vp isn= 't > > necessarily valid after the wakeup from the msleep. That's a problem th= at > > I'm having trouble figuring out a solution to - the solutions that come > > to mind will all significantly increase the overhead of the loop. > > As a very inadequate work-around, you might consider lowering > > kern.maxvnodes to something like 20000 - that might be low enough to > > not trigger the problem, but also be high enough to not significantly > > affect system I/O performance. >=20 > I think the following may be safe. It counts only the clean scanned vnodes > and does not evaluate the vp, that indeed may be reclaimed, after the sle= ep. >=20 > I never booted with the change. >=20 > diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c > index cbccc62..e686b97 100644 Or, better to use uio_yield(). See below. diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index cbccc62..5d2535f 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1176,6 +1176,7 @@ ffs_sync(mp, waitfor, td) struct ufsmount *ump =3D VFSTOUFS(mp); struct fs *fs; int error, count, wait, lockreq, allerror =3D 0; + int yield_count; int suspend; int suspended; int secondary_writes; @@ -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(); + goto relock_mp; + } continue; } MNT_IUNLOCK(mp); @@ -1247,6 +1255,7 @@ loop: if ((error =3D ffs_syncvnode(vp, waitfor)) !=3D 0) allerror =3D error; vput(vp); + relock_mp: MNT_ILOCK(mp); } MNT_IUNLOCK(mp); --wULyF7TL5taEdwHz Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFHaWHwC3+MBN1Mb4gRArC6AJ4rYZhWlamxL8uvszTZp2sVfNACkQCgqugO 4roWpidQRMN1XzFyhqB/2f0= =e7xk -----END PGP SIGNATURE----- --wULyF7TL5taEdwHz--