From owner-svn-src-head@freebsd.org Fri Nov 13 22:44:36 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 36B73A2E220; Fri, 13 Nov 2015 22:44:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B7C621A93; Fri, 13 Nov 2015 22:44:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.15.2/8.15.2) with ESMTPS id tADMiVkg073759 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 14 Nov 2015 01:44:31 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.15.2/8.15.2/Submit) id tADMiVGN073758; Sat, 14 Nov 2015 01:44:31 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Sat, 14 Nov 2015 01:44:31 +0300 From: Gleb Smirnoff To: Adrian Chadd Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r290481 - head/sys/kern Message-ID: <20151113224431.GD73031@FreeBSD.org> References: <201511070404.tA7440RE080849@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201511070404.tA7440RE080849@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) 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 22:44:36 -0000 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.