diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-07-25 12:55:41 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-07-25 12:55:41 +0000 |
commit | 8769fbf40387051a609dbe230e439304c7f84bda (patch) | |
tree | baff7d242cb1631b7535cd4162546124bc509a61 /sys | |
parent | cb91f1c3d43eb3ce9e571adddd8f4eeb61df7a5c (diff) |
Add an extra argument to uvm_unmap_remove(), for the caller to tell it
whether removing holes or parts of them is allowed or not.
Only allow hole removal in uvmspace_free(), when tearing the vmspace down.
ok art@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/i386/pmap.c | 4 | ||||
-rw-r--r-- | sys/uvm/uvm_io.c | 4 | ||||
-rw-r--r-- | sys/uvm/uvm_km.c | 4 | ||||
-rw-r--r-- | sys/uvm/uvm_map.c | 13 | ||||
-rw-r--r-- | sys/uvm/uvm_map.h | 4 | ||||
-rw-r--r-- | sys/uvm/uvm_mmap.c | 4 |
6 files changed, 18 insertions, 15 deletions
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index 3619ae37e96..00cd9bf142d 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.142 2009/06/16 16:42:41 ariane Exp $ */ +/* $OpenBSD: pmap.c,v 1.143 2009/07/25 12:55:39 miod Exp $ */ /* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */ /* @@ -1269,7 +1269,7 @@ pmap_free_pvpage(void) /* unmap the page */ dead_entries = NULL; uvm_unmap_remove(map, (vaddr_t)pvp, ((vaddr_t)pvp) + PAGE_SIZE, - &dead_entries, NULL); + &dead_entries, NULL, FALSE); vm_map_unlock(map); if (dead_entries != NULL) diff --git a/sys/uvm/uvm_io.c b/sys/uvm/uvm_io.c index f9fb928f4bb..1b9339979e1 100644 --- a/sys/uvm/uvm_io.c +++ b/sys/uvm/uvm_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_io.c,v 1.16 2005/11/04 21:48:07 miod Exp $ */ +/* $OpenBSD: uvm_io.c,v 1.17 2009/07/25 12:55:40 miod Exp $ */ /* $NetBSD: uvm_io.c,v 1.12 2000/06/27 17:29:23 mrg Exp $ */ /* @@ -140,7 +140,7 @@ uvm_io(vm_map_t map, struct uio *uio, int flags) vm_map_lock(kernel_map); uvm_unmap_remove(kernel_map, kva, kva+chunksz, - &dead_entries, NULL); + &dead_entries, NULL, FALSE); vm_map_unlock(kernel_map); if (dead_entries != NULL) diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index f30878ad873..b7604518559 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.c,v 1.74 2009/07/22 21:05:37 oga Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.75 2009/07/25 12:55:40 miod Exp $ */ /* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */ /* @@ -462,7 +462,7 @@ uvm_km_free_wakeup(struct vm_map *map, vaddr_t addr, vsize_t size) vm_map_lock(map); uvm_unmap_remove(map, trunc_page(addr), round_page(addr+size), - &dead_entries, NULL); + &dead_entries, NULL, FALSE); wakeup(map); vm_map_unlock(map); diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index 9c24fc7ee0a..1710efb09a3 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.118 2009/06/17 00:13:59 oga Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.119 2009/07/25 12:55:40 miod Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -1429,7 +1429,7 @@ uvm_unmap_p(vm_map_t map, vaddr_t start, vaddr_t end, struct proc *p) * detach from the dead entries... */ vm_map_lock(map); - uvm_unmap_remove(map, start, end, &dead_entries, p); + uvm_unmap_remove(map, start, end, &dead_entries, p, FALSE); vm_map_unlock(map); if (dead_entries != NULL) @@ -1454,7 +1454,7 @@ uvm_unmap_p(vm_map_t map, vaddr_t start, vaddr_t end, struct proc *p) void uvm_unmap_remove(struct vm_map *map, vaddr_t start, vaddr_t end, - struct vm_map_entry **entry_list, struct proc *p) + struct vm_map_entry **entry_list, struct proc *p, boolean_t remove_holes) { struct vm_map_entry *entry, *first_entry, *next; vaddr_t len; @@ -1539,7 +1539,10 @@ uvm_unmap_remove(struct vm_map *map, vaddr_t start, vaddr_t end, * we want to free these pages right away... */ if (UVM_ET_ISHOLE(entry)) { - /* nothing to do! */ + if (!remove_holes) { + entry = next; + continue; + } } else if (map->flags & VM_MAP_INTRSAFE) { uvm_km_pgremove_intrsafe(entry->start, entry->end); pmap_kremove(entry->start, len); @@ -3354,7 +3357,7 @@ uvmspace_free(struct vmspace *vm) if (vm->vm_map.nentries) { uvm_unmap_remove(&vm->vm_map, vm->vm_map.min_offset, vm->vm_map.max_offset, - &dead_entries, NULL); + &dead_entries, NULL, TRUE); if (dead_entries != NULL) uvm_unmap_detach(dead_entries, 0); } diff --git a/sys/uvm/uvm_map.h b/sys/uvm/uvm_map.h index cc5eae5db43..105e0451623 100644 --- a/sys/uvm/uvm_map.h +++ b/sys/uvm/uvm_map.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.h,v 1.40 2009/03/25 20:00:18 oga Exp $ */ +/* $OpenBSD: uvm_map.h,v 1.41 2009/07/25 12:55:40 miod Exp $ */ /* $NetBSD: uvm_map.h,v 1.24 2001/02/18 21:19:08 chs Exp $ */ /* @@ -299,7 +299,7 @@ int uvm_map_submap(vm_map_t, vaddr_t, vaddr_t, vm_map_t); void uvm_unmap_p(vm_map_t, vaddr_t, vaddr_t, struct proc *); void uvm_unmap_detach(vm_map_entry_t,int); void uvm_unmap_remove(vm_map_t, vaddr_t, vaddr_t, vm_map_entry_t *, - struct proc *); + struct proc *, boolean_t); #endif /* _KERNEL */ diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c index 34f9f89e8ff..3c2ec783af8 100644 --- a/sys/uvm/uvm_mmap.c +++ b/sys/uvm/uvm_mmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_mmap.c,v 1.78 2009/07/22 21:05:37 oga Exp $ */ +/* $OpenBSD: uvm_mmap.c,v 1.79 2009/07/25 12:55:40 miod Exp $ */ /* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */ /* @@ -742,7 +742,7 @@ sys_munmap(struct proc *p, void *v, register_t *retval) /* * doit! */ - uvm_unmap_remove(map, addr, addr + size, &dead_entries, p); + uvm_unmap_remove(map, addr, addr + size, &dead_entries, p, FALSE); vm_map_unlock(map); /* and unlock */ |