diff options
Diffstat (limited to 'sys/vm/vm_page.c')
-rw-r--r-- | sys/vm/vm_page.c | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index d768359259bb4..0c4a001390cd0 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91 - * $Id: vm_page.c,v 1.69.2.1 1996/11/09 21:16:08 phk Exp $ + * $Id: vm_page.c,v 1.69.2.2 1996/11/12 09:10:16 phk Exp $ */ /* @@ -98,16 +98,16 @@ static struct pglist *vm_page_buckets; /* Array of buckets */ static int vm_page_bucket_count; /* How big is array? */ static int vm_page_hash_mask; /* Mask for hash function */ -struct pglist vm_page_queue_free[PQ_L2_SIZE]; -struct pglist vm_page_queue_zero[PQ_L2_SIZE]; -struct pglist vm_page_queue_active; -struct pglist vm_page_queue_inactive; -struct pglist vm_page_queue_cache[PQ_L2_SIZE]; +struct pglist vm_page_queue_free[PQ_L2_SIZE] = {0}; +struct pglist vm_page_queue_zero[PQ_L2_SIZE] = {0}; +struct pglist vm_page_queue_active = {0}; +struct pglist vm_page_queue_inactive = {0}; +struct pglist vm_page_queue_cache[PQ_L2_SIZE] = {0}; -int no_queue; +int no_queue=0; -struct vpgqueues vm_page_queues[PQ_COUNT]; -int pqcnt[PQ_COUNT]; +struct vpgqueues vm_page_queues[PQ_COUNT] = {0}; +int pqcnt[PQ_COUNT] = {0}; static void vm_page_queue_init(void) { @@ -142,13 +142,13 @@ vm_page_queue_init(void) { } } -vm_page_t vm_page_array; -int vm_page_array_size; -long first_page; +vm_page_t vm_page_array = 0; +int vm_page_array_size = 0; +long first_page = 0; static long last_page; static vm_size_t page_mask; static int page_shift; -int vm_page_zero_count; +int vm_page_zero_count = 0; /* * map of contiguous valid DEV_BSIZE chunks in a page @@ -734,7 +734,7 @@ vm_page_alloc(object, pindex, page_req) { register vm_page_t m; struct vpgqueues *pq; - int queue; + int queue, qtype; int s; #ifdef DIAGNOSTIC @@ -835,15 +835,16 @@ vm_page_alloc(object, pindex, page_req) } queue = m->queue; - if (queue == PQ_ZERO) + qtype = queue - m->pc; + if (qtype == PQ_ZERO) --vm_page_zero_count; pq = &vm_page_queues[queue]; TAILQ_REMOVE(pq->pl, m, pageq); --(*pq->cnt); --(*pq->lcnt); - if ((m->queue - m->pc) == PQ_ZERO) { + if (qtype == PQ_ZERO) { m->flags = PG_ZERO|PG_BUSY; - } else if ((m->queue - m->pc) == PQ_CACHE) { + } else if (qtype == PQ_CACHE) { vm_page_remove(m); m->flags = PG_BUSY; } else { @@ -874,6 +875,26 @@ vm_page_alloc(object, pindex, page_req) return (m); } +void +vm_wait() +{ + int s; + + s = splvm(); + if (curproc == pageproc) { + vm_pageout_pages_needed = 1; + tsleep(&vm_pageout_pages_needed, PSWP, "vmwait", 0); + } else { + if (!vm_pages_needed) { + vm_pages_needed++; + wakeup(&vm_pages_needed); + } + tsleep(&cnt.v_free_count, PVM, "vmwait", 0); + } + splx(s); +} + + /* * vm_page_activate: * |