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 | |
parent | 9444a851b196cc13d41c780f8f45a06276136e05 (diff) |
Some updates to UVM from NetBSD. Nothing really critical, just a sync.
-rw-r--r-- | sys/uvm/uvm_extern.h | 10 | ||||
-rw-r--r-- | sys/uvm/uvm_mmap.c | 16 | ||||
-rw-r--r-- | sys/uvm/uvm_page.c | 41 | ||||
-rw-r--r-- | sys/uvm/uvm_swap.c | 10 | ||||
-rw-r--r-- | sys/uvm/uvm_unix.c | 4 | ||||
-rw-r--r-- | sys/vm/vm_page.h | 10 |
6 files changed, 50 insertions, 41 deletions
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index 5491dd744c8..e669456e8e5 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_extern.h,v 1.13 2001/06/23 19:24:33 smart Exp $ */ -/* $NetBSD: uvm_extern.h,v 1.34 1999/07/22 22:58:38 thorpej Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.14 2001/07/25 14:47:59 art Exp $ */ +/* $NetBSD: uvm_extern.h,v 1.35 1999/12/30 16:09:47 eeh Exp $ */ /* * @@ -335,7 +335,7 @@ void uvm_km_free_poolpage1 __P((vm_map_t, vaddr_t)); int uvm_map __P((vm_map_t, vaddr_t *, vsize_t, struct uvm_object *, vaddr_t, uvm_flag_t)); int uvm_map_pageable __P((vm_map_t, vaddr_t, - vaddr_t, boolean_t, boolean_t)); + vaddr_t, boolean_t, int)); int uvm_map_pageable_all __P((vm_map_t, int, vsize_t)); boolean_t uvm_map_checkprot __P((vm_map_t, vaddr_t, vaddr_t, vm_prot_t)); @@ -374,8 +374,8 @@ vaddr_t uvm_pagealloc_contig __P((vaddr_t, vaddr_t, void uvm_pagerealloc __P((struct vm_page *, struct uvm_object *, vaddr_t)); /* Actually, uvm_page_physload takes PF#s which need their own type */ -void uvm_page_physload __P((vaddr_t, vaddr_t, - vaddr_t, vaddr_t, int)); +void uvm_page_physload __P((paddr_t, paddr_t, + paddr_t, paddr_t, int)); void uvm_setpagesize __P((void)); /* uvm_pdaemon.c */ diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c index 33f6ee1a9fb..4511461fd9d 100644 --- a/sys/uvm/uvm_mmap.c +++ b/sys/uvm/uvm_mmap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_mmap.c,v 1.16 2001/07/25 13:25:33 art Exp $ */ -/* $NetBSD: uvm_mmap.c,v 1.36 1999/11/13 00:24:38 thorpej Exp $ */ +/* $OpenBSD: uvm_mmap.c,v 1.17 2001/07/25 14:47:59 art Exp $ */ +/* $NetBSD: uvm_mmap.c,v 1.37 1999/12/11 05:38:41 thorpej Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -1154,19 +1154,7 @@ uvm_mmap(map, addr, size, prot, maxprot, flags, handle, foff, locklimit) */ if (flags & MAP_ANON) { -#if 1 - /* - * Specify an offset of 0 so that uvm_map_findspace() via. - * uvm_map() will PMAP_PREFER the address for us. This - * prevents alias problems if the following occurs: - * - * - Anon region mapped. - * - File mapped over anon region (using MAP_FIXED). - */ - foff = 0; -#else foff = UVM_UNKNOWN_OFFSET; -#endif uobj = NULL; if ((flags & MAP_SHARED) == 0) /* XXX: defer amap create */ 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? */ diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c index d57013300d2..fe7e03bdf5b 100644 --- a/sys/uvm/uvm_swap.c +++ b/sys/uvm/uvm_swap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_swap.c,v 1.29 2001/07/18 14:28:01 art Exp $ */ -/* $NetBSD: uvm_swap.c,v 1.29 1999/10/16 23:53:29 wrstuden Exp $ */ +/* $OpenBSD: uvm_swap.c,v 1.30 2001/07/25 14:47:59 art Exp $ */ +/* $NetBSD: uvm_swap.c,v 1.31 2000/01/04 21:37:54 wrstuden Exp $ */ /* * Copyright (c) 1995, 1996, 1997 Matthew R. Green @@ -1203,9 +1203,8 @@ bad: /* * failure: close device if necessary and return error. */ - if (vp != rootvp) { + if (vp != rootvp) (void)VOP_CLOSE(vp, FREAD|FWRITE, p->p_ucred, p); - } return (error); } @@ -1261,9 +1260,8 @@ swap_off(p, sdp) extent_destroy(sdp->swd_ex); free(name, M_VMSWAP); free((caddr_t)sdp->swd_ex, M_VMSWAP); - if (sdp->swp_vp != rootvp) { + if (sdp->swp_vp != rootvp) (void) VOP_CLOSE(sdp->swd_vp, FREAD|FWRITE, p->p_ucred, p); - } if (sdp->swd_vp) vrele(sdp->swd_vp); free((caddr_t)sdp, M_VMSWAP); diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c index eef8c966119..7b0f894c782 100644 --- a/sys/uvm/uvm_unix.c +++ b/sys/uvm/uvm_unix.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_unix.c,v 1.10 2001/05/05 21:26:46 art Exp $ */ -/* $NetBSD: uvm_unix.c,v 1.8 1999/03/25 18:48:56 mrg Exp $ */ +/* $OpenBSD: uvm_unix.c,v 1.11 2001/07/25 14:47:59 art Exp $ */ +/* $NetBSD: uvm_unix.c,v 1.10 1999/12/30 16:09:47 eeh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 9c06453822f..3b275773afa 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_page.h,v 1.14 2001/07/05 07:32:54 art Exp $ */ +/* $OpenBSD: vm_page.h,v 1.15 2001/07/25 14:47:58 art Exp $ */ /* $NetBSD: vm_page.h,v 1.24 1998/02/10 14:09:03 mrg Exp $ */ /* @@ -195,10 +195,10 @@ struct vm_page { * vm_physmemseg: describes one segment of physical memory */ struct vm_physseg { - vaddr_t start; /* PF# of first page in segment */ - vaddr_t end; /* (PF# of last page in segment) + 1 */ - vaddr_t avail_start; /* PF# of first free page in segment */ - vaddr_t avail_end; /* (PF# of last free page in segment) +1 */ + paddr_t start; /* PF# of first page in segment */ + paddr_t end; /* (PF# of last page in segment) + 1 */ + paddr_t avail_start; /* PF# of first free page in segment */ + paddr_t avail_end; /* (PF# of last free page in segment) +1 */ int free_list; /* which free list they belong on */ struct vm_page *pgs; /* vm_page structures (from start) */ struct vm_page *lastpg; /* vm_page structure for end */ |