svn commit: r207970 - head/sys/kern
Pawel Jakub Dawidek
pjd at FreeBSD.org
Wed May 12 16:42:28 UTC 2010
Author: pjd
Date: Wed May 12 16:42:28 2010
New Revision: 207970
URL: http://svn.freebsd.org/changeset/base/207970
Log:
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 at zk.informjust.ua>
MFC after: 1 week
Modified:
head/sys/kern/vfs_subr.c
Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c Wed May 12 16:28:41 2010 (r207969)
+++ head/sys/kern/vfs_subr.c Wed May 12 16:42:28 2010 (r207970)
@@ -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.
More information about the svn-src-all
mailing list