- Add an event that is triggered when the system is low on memory. This is
intended to be used by significant memory consumers so that they may drain some of their caches. Inspired by: phk Approved by: re Tested on: x86, alpha
This commit is contained in:
parent
86248f7d29
commit
de79ec94a5
@ -179,5 +179,9 @@ typedef void (*idle_eventhandler_t)(void *, int);
|
||||
#define IDLE_PRI_LAST 20000
|
||||
EVENTHANDLER_FAST_DECLARE(idle_event, idle_eventhandler_t);
|
||||
|
||||
/* Low memory event */
|
||||
typedef void (*vm_lowmem_handler_t)(void *, int);
|
||||
#define LOWMEM_PRI_DEFAULT 0
|
||||
EVENTHANDLER_DECLARE(vm_lowmem, vm_lowmem_handler_t);
|
||||
|
||||
#endif /* SYS_EVENTHANDLER_H */
|
||||
|
@ -76,6 +76,7 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/eventhandler.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/proc.h>
|
||||
@ -677,11 +678,18 @@ vm_pageout_scan(int pass)
|
||||
struct thread *td;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
/*
|
||||
* Decrease registered cache sizes.
|
||||
*/
|
||||
EVENTHANDLER_INVOKE(vm_lowmem, 0);
|
||||
/*
|
||||
* We do this explicitly after the caches have been drained above.
|
||||
*/
|
||||
uma_reclaim();
|
||||
/*
|
||||
* Do whatever cleanup that the pmap code can.
|
||||
*/
|
||||
vm_pageout_pmap_collect();
|
||||
uma_reclaim();
|
||||
|
||||
addl_page_shortage_init = vm_pageout_deficit;
|
||||
vm_pageout_deficit = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user