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.)
This commit is contained in:
Adrian Chadd 2015-11-07 04:04:00 +00:00
parent 8e5c71e2d6
commit 2eb936acb9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290481

View File

@ -3622,6 +3622,23 @@ getblk(struct vnode *vp, daddr_t blkno, int size, int slpflag, int slptimeo,
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;
}