From 9b4552a22d3abb08bb25f4e0035b164fce358d99 Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Tue, 29 Jun 1999 23:34:14 +0000 Subject: 1999-06-29 Thomas Bushnell, BSG * 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. --- vm/vm_pageout.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'vm/vm_pageout.c') diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c index 1a986b4c..af605ac7 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; /* -- cgit v1.2.3