From owner-svn-src-head@freebsd.org Fri Nov 13 23:52:46 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A62A7A2E228; Fri, 13 Nov 2015 23:52:46 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x235.google.com (mail-io0-x235.google.com [IPv6:2607:f8b0:4001:c06::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 720F71916; Fri, 13 Nov 2015 23:52:46 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by iofh3 with SMTP id h3so113239534iof.3; Fri, 13 Nov 2015 15:52:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=QtwFM+itwUtD2lmDmorpuRnUJ8n1jWJOCI6bdqYz1hI=; b=0QzLQ8+jQnZ4Aef9iw3m7ZQn0lEgmsbdzG/s+HYd9bWmCCiOaUNjNdsuDt2jNCQdGl cnNxgpy53tb6ReQZVtEV2ZUwoZyNTdBfwJbc1jno48t0cwLCCkNQX1kl4pfuTHqm4yKk aSahhM9wVT7s5Rcz+l6AurSi+yMC1jMWw+whM/FHoS3hkdfvkbIvMAgYTbeiC9LWvf9x HsvZTgjF24zIj5DLNKQK/yondwc8LhN5hEuasuG8sfgyvBILFZZgMXRzccvDnDjlb6jD n2tcIvx6Dp3uDV2BU8B+m+jz1c+M+QZt4Fx7UqEbcTeoVPRcJg0JU/YNpK5aKmn+0fgz Zu7w== MIME-Version: 1.0 X-Received: by 10.107.152.2 with SMTP id a2mr21861461ioe.123.1447458765785; Fri, 13 Nov 2015 15:52:45 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.36.217.196 with HTTP; Fri, 13 Nov 2015 15:52:45 -0800 (PST) In-Reply-To: <20151113224431.GD73031@FreeBSD.org> References: <201511070404.tA7440RE080849@repo.freebsd.org> <20151113224431.GD73031@FreeBSD.org> Date: Fri, 13 Nov 2015 15:52:45 -0800 X-Google-Sender-Auth: FFgpECMV_8riGiSPonTKMLM1Nhk Message-ID: Subject: Re: svn commit: r290481 - head/sys/kern From: Adrian Chadd To: Gleb Smirnoff Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2015 23:52:46 -0000 Peter Holm already approached me to ask about it. The problem has been figuring out how to trigger it in an automated / VM way. :( -a On 13 November 2015 at 14:44, Gleb Smirnoff wrote: > On Sat, Nov 07, 2015 at 04:04:00AM +0000, Adrian Chadd wrote: > A> Author: adrian > A> Date: Sat Nov 7 04:04:00 2015 > A> New Revision: 290481 > A> URL: https://svnweb.freebsd.org/changeset/base/290481 > A> > A> Log: > A> Add a sched_yield() to work around low memory conditions in the current code. > A> > A> Things seem to get stuck in low memory conditions where no bufs are available, > A> the reclamation path is called to wakeup the daemon, but no sleeping is done. > A> Because of this, we are stuck in a tight loop in the current process and > A> never run said reclamation path. > A> > A> This was introduced in r289279 . This is only a temporary workaround > A> to restore system usefulness until the more permanent solutions can be > A> found. > A> > A> Tested: > A> > A> * Carambola2, 64MB (and 32MB by manual config.) > A> > A> Modified: > A> head/sys/kern/vfs_bio.c > A> > A> Modified: head/sys/kern/vfs_bio.c > A> ============================================================================== > A> --- head/sys/kern/vfs_bio.c Sat Nov 7 02:18:19 2015 (r290480) > A> +++ head/sys/kern/vfs_bio.c Sat Nov 7 04:04:00 2015 (r290481) > A> @@ -3622,6 +3622,23 @@ loop: > A> if (bp == NULL) { > A> if (slpflag || slptimeo) > A> return NULL; > A> + /* > A> + * XXX This is here until the sleep path is diagnosed > A> + * enough to work under very low memory conditions. > A> + * > A> + * There's an issue on low memory, 4BSD+non-preempt > A> + * systems (eg MIPS routers with 32MB RAM) where buffer > A> + * exhaustion occurs without sleeping for buffer > A> + * reclaimation. This just sticks in a loop and > A> + * constantly attempts to allocate a buffer, which > A> + * hits exhaustion and tries to wakeup bufdaemon. > A> + * This never happens because we never yield. > A> + * > A> + * The real solution is to identify and fix these cases > A> + * so we aren't effectively busy-waiting in a loop > A> + * until the reclaimation path has cycles to run. > A> + */ > A> + kern_yield(PRI_USER); > A> goto loop; > A> } > > It'll be nice if such crutches have a test case in src/tests, and a > reference to it in the comment above. So that in future, someone > considering that the crutch is no longer needed, can quickly check that > assumption. > > -- > Totus tuus, Glebius.