From owner-freebsd-current@FreeBSD.ORG Thu Feb 5 09:19:57 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 563C9EFE; Thu, 5 Feb 2015 09:19:57 +0000 (UTC) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 340ECB2E; Thu, 5 Feb 2015 09:19:56 +0000 (UTC) Received: from [100.114.11.106] (156.sub-70-211-79.myvzw.com [70.211.79.156]) by elvis.mu.org (Postfix) with ESMTPSA id 2BD3A341F912; Thu, 5 Feb 2015 01:19:56 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: Weird behavior writing to SSD on 2013 MacBook From: Alfred Perlstein X-Mailer: iPhone Mail (12B440) In-Reply-To: <20150205090324.GI42409@kib.kiev.ua> Date: Thu, 5 Feb 2015 01:19:53 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <54D2C3DA.4060205@freebsd.org> <54D319EA.5020709@freebsd.org> <20150205083035.GF42409@kib.kiev.ua> <54D32DC3.6020409@mu.org> <20150205090324.GI42409@kib.kiev.ua> To: Konstantin Belousov Cc: FreeBSD Current , Dimitry Andric , "Lundberg, Johannes" , Allan Jude X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Feb 2015 09:19:57 -0000 It's possible original intent of that construct was just a pause/throttle if= it used to be an if(). Makes sense although should investigate further.=20 Sent from my iPhone > On Feb 5, 2015, at 1:03 AM, Konstantin Belousov wrot= e: >=20 >> On Thu, Feb 05, 2015 at 12:45:55AM -0800, Alfred Perlstein wrote: >>=20 >>=20 >>> On 2/5/15 12:30 AM, Konstantin Belousov wrote: >>>> On Thu, Feb 05, 2015 at 08:56:59AM +0100, Dimitry Andric wrote: >>>> If you let bsdtar continue, and press control-T a few times, does the >>>> user time (u) increase at all? Does it ever go any further, if you let= >>>> it run for a very long time? >>>>=20 >>>> I believe a problem may have been introduced by r277922, leading to >>>> filesystem hangs in some scenarios. It looks like this commit is also >>>> in dumbbell's github fork: >>>>=20 >>>> https://github.com/dumbbell/freebsd/commit/83723416a6bb8695d60c6573722a= 81086899f521 >>>=20 >>> Would be nice if you mailed me with your findings. >>>=20 >>> Please try this. >>>=20 >>> diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c >>> index 79783c8..700854e 100644 >>> --- a/sys/ufs/ffs/ffs_softdep.c >>> +++ b/sys/ufs/ffs/ffs_softdep.c >>> @@ -1393,7 +1393,7 @@ softdep_flush(addr) >>> VFSTOUFS(mp)->softdep_jblocks->jb_suspended)) >>> kthread_suspend_check(); >>> ACQUIRE_LOCK(ump); >>> - while ((ump->softdep_flags & (FLUSH_CLEANUP | FLUSH_EXIT)) =3D=3D= 0) >>> + if ((ump->softdep_flags & (FLUSH_CLEANUP | FLUSH_EXIT)) =3D=3D 0= ) >>> msleep(&ump->softdep_flushtd, LOCK_PTR(ump), PVM, >>> "sdflush", hz / 2); >>> ump->softdep_flags &=3D ~FLUSH_CLEANUP; >>> @@ -1423,10 +1423,9 @@ worklist_speedup(mp) >>>=20 >>> ump =3D VFSTOUFS(mp); >>> LOCK_OWNED(ump); >>> - if ((ump->softdep_flags & (FLUSH_CLEANUP | FLUSH_EXIT)) =3D=3D 0) {= >>> + if ((ump->softdep_flags & (FLUSH_CLEANUP | FLUSH_EXIT)) =3D=3D 0) >>> ump->softdep_flags |=3D FLUSH_CLEANUP; >>> - wakeup(&ump->softdep_flushtd); >>> - } >>> + wakeup(&ump->softdep_flushtd); >>> } >>>=20 >>> static int >>> @@ -1471,11 +1470,10 @@ softdep_speedup(ump) >>> TAILQ_INSERT_TAIL(&softdepmounts, sdp, sd_next); >>> FREE_GBLLOCK(&lk); >>> if ((altump->softdep_flags & >>> - (FLUSH_CLEANUP | FLUSH_EXIT)) =3D=3D 0) { >>> + (FLUSH_CLEANUP | FLUSH_EXIT)) =3D=3D 0) >>> altump->softdep_flags |=3D FLUSH_CLEANUP; >>> - altump->um_softdep->sd_cleanups++; >>> - wakeup(&altump->softdep_flushtd); >>> - } >>> + altump->um_softdep->sd_cleanups++; >>> + wakeup(&altump->softdep_flushtd); >>> FREE_LOCK(altump); >>> } >>> } >>> _______________________________________________ >>=20 >> Why the conversion of while() to if()? >>=20 >>=20 >> The reason for a while() when doing msleep/wakeup is typically to=20 >> prevent superfluous wakeups from signalling early. >=20 > if()->while() was one of the changes in r277922, and I suspect that it > is the cause of the issue. I.e. my thought right now is that > softdep_process_worklist() does not keep up with the requests. >=20 > If this is true, then real fix is somewhere else, but restoring > pre-r277922 behaviour should get rid of immediate pain. >=20