svn commit: r290481 - head/sys/kern

Adrian Chadd adrian at FreeBSD.org
Sat Nov 7 04:04:02 UTC 2015


Author: adrian
Date: Sat Nov  7 04:04:00 2015
New Revision: 290481
URL: https://svnweb.freebsd.org/changeset/base/290481

Log:
  Add a sched_yield() to work around low memory conditions in the current code.
  
  Things seem to get stuck in low memory conditions where no bufs are available,
  the reclamation path is called to wakeup the daemon, but no sleeping is done.
  Because of this, we are stuck in a tight loop in the current process and
  never run said reclamation path.
  
  This was introduced in r289279 . This is only a temporary workaround
  to restore system usefulness until the more permanent solutions can be
  found.
  
  Tested:
  
  * Carambola2, 64MB (and 32MB by manual config.)

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Sat Nov  7 02:18:19 2015	(r290480)
+++ head/sys/kern/vfs_bio.c	Sat Nov  7 04:04:00 2015	(r290481)
@@ -3622,6 +3622,23 @@ loop:
 		if (bp == NULL) {
 			if (slpflag || slptimeo)
 				return NULL;
+			/*
+			 * XXX This is here until the sleep path is diagnosed
+			 * enough to work under very low memory conditions.
+			 *
+			 * There's an issue on low memory, 4BSD+non-preempt
+			 * systems (eg MIPS routers with 32MB RAM) where buffer
+			 * exhaustion occurs without sleeping for buffer
+			 * reclaimation.  This just sticks in a loop and
+			 * constantly attempts to allocate a buffer, which
+			 * hits exhaustion and tries to wakeup bufdaemon.
+			 * This never happens because we never yield.
+			 *
+			 * The real solution is to identify and fix these cases
+			 * so we aren't effectively busy-waiting in a loop
+			 * until the reclaimation path has cycles to run.
+			 */
+			kern_yield(PRI_USER);
 			goto loop;
 		}
 


More information about the svn-src-head mailing list