diff options
author | pjd <pjd@FreeBSD.org> | 2010-05-12 16:42:28 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2010-05-12 16:42:28 +0000 |
commit | 05f836c1c3fdb085eb93908c94736251d6a86f6d (patch) | |
tree | 9407cf675ef2e959341f5e533dee318ce2cddccd /sys/kern | |
parent | 594aca58ad846418017ee3a6c20061f3887aee07 (diff) | |
download | FreeBSD-src-05f836c1c3fdb085eb93908c94736251d6a86f6d.zip FreeBSD-src-05f836c1c3fdb085eb93908c94736251d6a86f6d.tar.gz |
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
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_subr.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index d93d2d8..1fb131a 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -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. |