summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1999-06-29 23:34:14 +0000
committerThomas Bushnell <thomas@gnu.org>1999-06-29 23:34:14 +0000
commit9b4552a22d3abb08bb25f4e0035b164fce358d99 (patch)
tree20f5b5ad90539d71e20b3cefa85c409de6949bb1
parentc800de6a35683e6984124fdb4f8392f6b6991627 (diff)
1999-06-29 Thomas Bushnell, BSG <tb@mit.edu>
* vm/vm_resident.c (vm_page_grab): Don't bounce requests when vm_page_external_count == vm_page_external_limit, so that before initialization is complete we can still allocate memory without relying on current_thread. (vm_page_wait): Also block if we are over the external page limit. * vm/vm_pageout.c (vm_pageout_scan): Rewrite the scan-for-pages-to-pageout loop to not crash when we hit the end of the inactive queue; instead jump back to the pause-for-a-little-while code.
-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);