Index: sys/vm/uma_core.c =================================================================== --- sys/vm/uma_core.c +++ sys/vm/uma_core.c @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -3199,6 +3200,9 @@ "umarcl", 0); if (uma_reclaim_needed) { uma_reclaim_needed = 0; + sx_xunlock(&uma_drain_lock); + EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_KVA); + sx_xlock(&uma_drain_lock); uma_reclaim_locked(true); } } Index: sys/vm/vm_kern.c =================================================================== --- sys/vm/vm_kern.c +++ sys/vm/vm_kern.c @@ -552,11 +552,13 @@ error = sysctl_handle_int(oidp, &i, 0, req); if (error) return (error); - if (i) - EVENTHANDLER_INVOKE(vm_lowmem, 0); + if ((i & ~(VM_LOW_KVA | VM_LOW_PAGES)) != 0) + return (EINVAL); + if (i) + 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 Index: sys/vm/vm_pageout.h =================================================================== --- sys/vm/vm_pageout.h +++ sys/vm/vm_pageout.h @@ -87,6 +87,12 @@ #define VM_OOM_SWAPZ 2 /* + * vm_lowmem flags. + */ +#define VM_LOW_KVA 1 +#define VM_LOW_PAGES 2 + +/* * Exported routines. */ Index: sys/vm/vm_pageout.c =================================================================== --- sys/vm/vm_pageout.c +++ sys/vm/vm_pageout.c @@ -1332,7 +1332,7 @@ * 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.