Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 05 Feb 2015 00:45:55 -0800
From:      Alfred Perlstein <bright@mu.org>
To:        Konstantin Belousov <kostikbel@gmail.com>,  Dimitry Andric <dim@FreeBSD.org>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>, "Lundberg, Johannes" <johannes@brilliantservice.co.jp>, Allan Jude <allanjude@freebsd.org>
Subject:   Re: Weird behavior writing to SSD on 2013 MacBook
Message-ID:  <54D32DC3.6020409@mu.org>
In-Reply-To: <20150205083035.GF42409@kib.kiev.ua>
References:  <CAASDrV=d=7aGdsDzDxRS2aXW%2BtWijVmNWrCNSYLWrWWvgwYx6Q@mail.gmail.com> <54D2C3DA.4060205@freebsd.org> <CAASDrV=9zrG8mH0Cn770yJLG6cBxuFjBQthhcHB_q4e7Afthww@mail.gmail.com> <CAASDrVnY8RQV2C=k=_v=23VD%2BQcXYegm1SLQPXDULwfQQ1xsDA@mail.gmail.com> <54D319EA.5020709@freebsd.org> <CAASDrVmcOzQiNMhi5dukd4PEyGXV4_T71jh3E3DfaWjKWWWM6g@mail.gmail.com> <AF0781EF-50BD-4CAB-8FEC-6334EED6DACF@FreeBSD.org> <20150205083035.GF42409@kib.kiev.ua>

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


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?
>>
>> 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:
>>
>> https://github.com/dumbbell/freebsd/commit/83723416a6bb8695d60c6573722a81086899f521
>>
>
> Would be nice if you mailed me with your findings.
>
> Please try this.
>
> 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)) == 0)
> +		if ((ump->softdep_flags & (FLUSH_CLEANUP | FLUSH_EXIT)) == 0)
>   			msleep(&ump->softdep_flushtd, LOCK_PTR(ump), PVM,
>   			    "sdflush", hz / 2);
>   		ump->softdep_flags &= ~FLUSH_CLEANUP;
> @@ -1423,10 +1423,9 @@ worklist_speedup(mp)
>
>   	ump = VFSTOUFS(mp);
>   	LOCK_OWNED(ump);
> -	if ((ump->softdep_flags & (FLUSH_CLEANUP | FLUSH_EXIT)) == 0) {
> +	if ((ump->softdep_flags & (FLUSH_CLEANUP | FLUSH_EXIT)) == 0)
>   		ump->softdep_flags |= FLUSH_CLEANUP;
> -		wakeup(&ump->softdep_flushtd);
> -	}
> +	wakeup(&ump->softdep_flushtd);
>   }
>
>   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)) == 0) {
> +			    (FLUSH_CLEANUP | FLUSH_EXIT)) == 0)
>   				altump->softdep_flags |= FLUSH_CLEANUP;
> -				altump->um_softdep->sd_cleanups++;
> -				wakeup(&altump->softdep_flushtd);
> -			}
> +			altump->um_softdep->sd_cleanups++;
> +			wakeup(&altump->softdep_flushtd);
>   			FREE_LOCK(altump);
>   		}
>   	}
> _______________________________________________

Why the conversion of while() to if()?


The reason for a while() when doing msleep/wakeup is typically to 
prevent superfluous wakeups from signalling early.

-Alfred



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