Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 May 2010 16:42:28 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r207970 - head/sys/kern
Message-ID:  <201005121642.o4CGgS8h063841@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005121642.o4CGgS8h063841>