svn commit: r188964 - head/sys/vm

[ Available lists | Index of svn-src-all | Month of Feb 2009 | Week of 23 Feb 2009 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Robert Watson <rwatson@FreeBSD.org>
Date
23 Feb 2009 23:00:13
Subject
svn commit: r188964 - head/sys/vm
Message-ID
200902232300.n1NN0Dwa042166@svn.freebsd.org


[ Hide this part ]
Author: rwatson
Date: Mon Feb 23 23:00:12 2009
New Revision: 188964
URL: http://svn.freebsd.org/changeset/base/188964

Log:
Add a debugging sysctl, debug.vm_lowmem, that when assigned a value of
1 will trigger a pass through the VM's low-memory handlers, such as
protocol and UMA drain routines. This makes it easier to exercise
these otherwise rarely-invoked code paths.

MFC after: 3 days

Modified:
head/sys/vm/vm_kern.c

Modified: head/sys/vm/vm_kern.c
==============================================================================
--- head/sys/vm/vm_kern.c Mon Feb 23 22:58:59 2009 (r188963)
+++ head/sys/vm/vm_kern.c Mon Feb 23 23:00:12 2009 (r188964)
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/malloc.h>
+#include <sys/sysctl.h>

#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -500,3 +501,24 @@ kmem_init(start, end)
/* ... and ending with the completion of the above `insert' */
vm_map_unlock(m);
}
+
+/*
+ * Allow userspace to directly trigger the VM drain routine for testing
+ * purposes.
+ */
+static int
+debug_vm_lowmem(SYSCTL_HANDLER_ARGS)
+{
+ int error, i;
+
+ i = 0;
+ error = sysctl_handle_int(oidp, &i, 0, req);
+ if (error)
+ return (error);
+ if (i)
+ EVENTHANDLER_INVOKE(vm_lowmem, 0);
+ return (0);
+}
+
+SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_RW, 0, 0,
+ debug_vm_lowmem, "I", "set to trigger vm_lowmem event");


Elapsed time: 0.361 seconds