summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_page.c
diff options
context:
space:
mode:
authorsilby <silby@FreeBSD.org>2002-02-19 18:34:02 +0000
committersilby <silby@FreeBSD.org>2002-02-19 18:34:02 +0000
commitd2e8b2531b7bad266bd3129197e12bb0a24fecdc (patch)
tree0422c97f5c3abd970e82918ecba7ad8cb7fa7b7f /sys/vm/vm_page.c
parent3ea171f473051ad2c791ce153547748bd57b3bb5 (diff)
downloadFreeBSD-src-d2e8b2531b7bad266bd3129197e12bb0a24fecdc.zip
FreeBSD-src-d2e8b2531b7bad266bd3129197e12bb0a24fecdc.tar.gz
Changes to make the OOM killer much more effective:
- Allow the OOM killer to target processes currently locked in memory. These very often are the ones doing the memory hogging. - Drop the wakeup priority of processes currently sleeping while waiting for their page fault to complete. In order for the OOM killer to work well, the killed process and other system processes waiting on memory must be allowed to wakeup first. Reviewed by: dillon MFC after: 1 week
Diffstat (limited to 'sys/vm/vm_page.c')
-rw-r--r--sys/vm/vm_page.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index abc4194..2c0052b 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -967,6 +967,7 @@ loop:
* vm_wait: (also see VM_WAIT macro)
*
* Block until free pages are available for allocation
+ * - Called in various places before memory allocations.
*/
void
@@ -989,6 +990,28 @@ vm_wait(void)
}
/*
+ * vm_waitpfault: (also see VM_WAITPFAULT macro)
+ *
+ * Block until free pages are available for allocation
+ * - Called only in vm_fault so that processes page faulting
+ * can be easily tracked.
+ */
+
+void
+vm_waitpfault(void)
+{
+ int s;
+
+ s = splvm();
+ if (!vm_pages_needed) {
+ vm_pages_needed = 1;
+ wakeup(&vm_pages_needed);
+ }
+ tsleep(&cnt.v_free_count, PUSER, "pfault", 0);
+ splx(s);
+}
+
+/*
* vm_page_activate:
*
* Put the specified page on the active list (if appropriate).
OpenPOWER on IntegriCloud