summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_map.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-07-25 12:55:41 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-07-25 12:55:41 +0000
commit8769fbf40387051a609dbe230e439304c7f84bda (patch)
treebaff7d242cb1631b7535cd4162546124bc509a61 /sys/uvm/uvm_map.c
parentcb91f1c3d43eb3ce9e571adddd8f4eeb61df7a5c (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/uvm/uvm_map.c')
-rw-r--r--sys/uvm/uvm_map.c13
1 files changed, 8 insertions, 5 deletions
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);
}