When there is no memory or KVA, try to help by reclaiming some vnodes.

This helps with 'kmem_map too small' panics.

No objections from:	kib
Tested by:		Alexander V. Ribchansky <shurik@zk.informjust.ua>
MFC after:		1 week
This commit is contained in:
pjd 2010-05-12 16:42:28 +00:00
parent 594aca58ad
commit 05f836c1c3

View File

@ -821,6 +821,19 @@ static struct kproc_desc vnlru_kp = {
};
SYSINIT(vnlru, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, kproc_start,
&vnlru_kp);
static void
vfs_lowmem(void *arg __unused)
{
/*
* On low memory condition free 1/8th of the free vnodes.
*/
mtx_lock(&vnode_free_list_mtx);
vnlru_free(freevnodes / 8);
mtx_unlock(&vnode_free_list_mtx);
}
EVENTHANDLER_DEFINE(vm_lowmem, vfs_lowmem, NULL, 0);
/*
* Routines having to do with the management of the vnode table.