diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-07-25 14:48:00 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-07-25 14:48:00 +0000 |
commit | 8a9a821cdac41de2d9a03368fd682a37b552a59d (patch) | |
tree | a425246dc7ae56da1f613097528483e4d45dc875 /sys/uvm/uvm_page.c | |
parent | 9444a851b196cc13d41c780f8f45a06276136e05 (diff) |
Some updates to UVM from NetBSD. Nothing really critical, just a sync.
Diffstat (limited to 'sys/uvm/uvm_page.c')
-rw-r--r-- | sys/uvm/uvm_page.c | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c index 04b9c9610ae..bca622eeaed 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_page.c,v 1.18 2001/07/19 14:31:32 art Exp $ */ -/* $NetBSD: uvm_page.c,v 1.25 1999/09/12 01:17:38 chs Exp $ */ +/* $OpenBSD: uvm_page.c,v 1.19 2001/07/25 14:47:59 art Exp $ */ +/* $NetBSD: uvm_page.c,v 1.29 1999/12/30 16:09:47 eeh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -209,9 +209,9 @@ void uvm_page_init(kvm_startp, kvm_endp) vaddr_t *kvm_startp, *kvm_endp; { - int freepages, pagecount; + vsize_t freepages, pagecount, n; vm_page_t pagearray; - int lcv, n, i; + int lcv, i; paddr_t paddr; @@ -289,8 +289,8 @@ uvm_page_init(kvm_startp, kvm_endp) n = vm_physmem[lcv].end - vm_physmem[lcv].start; if (n > pagecount) { - printf("uvm_page_init: lost %d page(s) in init\n", - n - pagecount); + printf("uvm_page_init: lost %ld page(s) in init\n", + (long)(n - pagecount)); panic("uvm_page_init"); /* XXXCDC: shouldn't happen? */ /* n = pagecount; */ } @@ -459,9 +459,13 @@ uvm_pageboot_alloc(size) * => return false if out of memory. */ -boolean_t -uvm_page_physget(paddrp) +/* subroutine: try to allocate from memory chunks on the specified freelist */ +static boolean_t uvm_page_physget_freelist __P((paddr_t *, int)); + +static boolean_t +uvm_page_physget_freelist(paddrp, freelist) paddr_t *paddrp; + int freelist; { int lcv, x; @@ -477,6 +481,9 @@ uvm_page_physget(paddrp) if (uvm.page_init_done == TRUE) panic("vm_page_physget: called _after_ bootstrap"); + if (vm_physmem[lcv].free_list != freelist) + continue; + /* try from front */ if (vm_physmem[lcv].avail_start == vm_physmem[lcv].start && vm_physmem[lcv].avail_start < vm_physmem[lcv].avail_end) { @@ -548,6 +555,19 @@ uvm_page_physget(paddrp) return (FALSE); /* whoops! */ } + +boolean_t +uvm_page_physget(paddrp) + paddr_t *paddrp; +{ + int i; + + /* try in the order of freelist preference */ + for (i = 0; i < VM_NFREELIST; i++) + if (uvm_page_physget_freelist(paddrp, i) == TRUE) + return (TRUE); + return (FALSE); +} #endif /* PMAP_STEAL_MEMORY */ /* @@ -561,7 +581,7 @@ uvm_page_physget(paddrp) void uvm_page_physload(start, end, avail_start, avail_end, free_list) - vaddr_t start, end, avail_start, avail_end; + paddr_t start, end, avail_start, avail_end; int free_list; { int preload, lcv; @@ -575,6 +595,9 @@ uvm_page_physload(start, end, avail_start, avail_end, free_list) if (free_list >= VM_NFREELIST || free_list < VM_FREELIST_DEFAULT) panic("uvm_page_physload: bad free list %d\n", free_list); + if (start >= end) + panic("uvm_page_physload: start >= end"); + /* * do we have room? */ |