summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/uma_core.c4
-rw-r--r--sys/vm/vm_kern.c8
-rw-r--r--sys/vm/vm_pageout.c2
-rw-r--r--sys/vm/vm_pageout.h6
4 files changed, 16 insertions, 4 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 90ed297..35f65e6 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bitset.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/types.h>
#include <sys/queue.h>
@@ -3199,6 +3200,9 @@ uma_reclaim_worker(void *arg __unused)
"umarcl", 0);
if (uma_reclaim_needed) {
uma_reclaim_needed = 0;
+ sx_xunlock(&uma_drain_lock);
+ EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_KMEM);
+ sx_xlock(&uma_drain_lock);
uma_reclaim_locked(true);
}
}
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
index f56dbca..1b15f97 100644
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -549,11 +549,13 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS)
error = sysctl_handle_int(oidp, &i, 0, req);
if (error)
return (error);
- if (i)
- EVENTHANDLER_INVOKE(vm_lowmem, 0);
+ if ((i & ~(VM_LOW_KMEM | VM_LOW_PAGES)) != 0)
+ return (EINVAL);
+ if (i != 0)
+ EVENTHANDLER_INVOKE(vm_lowmem, i);
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");
+ debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags");
#endif
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index a2b2ddb..cd8fe45 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -871,7 +871,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
* Decrease registered cache sizes.
*/
SDT_PROBE0(vm, , , vm__lowmem_scan);
- EVENTHANDLER_INVOKE(vm_lowmem, 0);
+ EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_PAGES);
/*
* We do this explicitly after the caches have been
* drained above.
diff --git a/sys/vm/vm_pageout.h b/sys/vm/vm_pageout.h
index c677197..b44ca2f 100644
--- a/sys/vm/vm_pageout.h
+++ b/sys/vm/vm_pageout.h
@@ -87,6 +87,12 @@ extern bool vm_pages_needed;
#define VM_OOM_SWAPZ 2
/*
+ * vm_lowmem flags.
+ */
+#define VM_LOW_KMEM 0x01
+#define VM_LOW_PAGES 0x02
+
+/*
* Exported routines.
*/
OpenPOWER on IntegriCloud