summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
Diffstat (limited to 'vm')
-rw-r--r--vm/vm_pageout.c22
-rw-r--r--vm/vm_resident.c3
2 files changed, 19 insertions, 6 deletions
diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c
index 1a986b4..af605ac 100644
--- a/vm/vm_pageout.c
+++ b/vm/vm_pageout.c
@@ -658,7 +658,7 @@ void vm_pageout_scan()
* consumes memory. We don't take the risk of doing
* this if the default pager already has work to do.
*/
-
+ pause:
if (queue_empty(&vm_page_queue_inactive) ||
(burst_count >= vm_pageout_burst_max) ||
(vm_page_laundry_count >= vm_pageout_burst_max) ||
@@ -701,10 +701,22 @@ void vm_pageout_scan()
}
vm_pageout_inactive++;
- for (m = (vm_page_t) queue_first(&vm_page_queue_inactive);
- want_pages || m->external;
- m = queue_next(m))
- assert(!m->active && m->inactive);
+
+ /* Find a page we are interested in paging out. If we
+ need pages, then we'll page anything out; otherwise
+ we only page out external pages. */
+ m = (vm_page_t) queue_first (&vm_page_queue_inactive);
+ while (1)
+ {
+ assert (!m->active && m->inactive);
+ if (want_pages || m->external)
+ break;
+
+ m = (vm_page_t) queue_next (m);
+ if (!m)
+ goto pause;
+ }
+
object = m->object;
/*
diff --git a/vm/vm_resident.c b/vm/vm_resident.c
index 58d9827..f9441ad 100644
--- a/vm/vm_resident.c
+++ b/vm/vm_resident.c
@@ -1212,7 +1212,8 @@ void vm_page_wait(
*/
simple_lock(&vm_page_queue_free_lock);
- if (vm_page_free_count < vm_page_free_target) {
+ if ((vm_page_free_count < vm_page_free_target)
+ || (vm_page_external_count > vm_page_external_limit)) {
if (vm_page_free_wanted++ == 0)
thread_wakeup((event_t)&vm_page_free_wanted);
assert_wait((event_t)&vm_page_free_count, FALSE);