From 6c527f260e2b1433ae7b4b07865cffddf265cce5 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 23 Sep 2003 04:28:04 +0000 Subject: [PATCH] Change the handling of the kernel and kmem objects in vm_map_delete(): In order to use "unmanaged" pages in the kmem object, vm_map_delete() must unconditionally perform pmap_remove(). Otherwise, sparc64 has problems. Tested by: jake --- sys/vm/vm_map.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 31972f532752..ebc4040bb326 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -2185,32 +2185,27 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offset_t end) offidxend = offidxstart + count; - if (object == kernel_object || object == kmem_object) { + mtx_lock(&Giant); + vm_page_lock_queues(); + pmap_remove(map->pmap, s, e); + vm_page_unlock_queues(); + if (object != NULL) { VM_OBJECT_LOCK(object); - vm_object_page_remove(object, offidxstart, offidxend, FALSE); - VM_OBJECT_UNLOCK(object); - } else { - mtx_lock(&Giant); - vm_page_lock_queues(); - pmap_remove(map->pmap, s, e); - vm_page_unlock_queues(); - if (object != NULL) { - VM_OBJECT_LOCK(object); - if (object->ref_count != 1 && - (object->flags & (OBJ_NOSPLIT|OBJ_ONEMAPPING)) == OBJ_ONEMAPPING && - (object->type == OBJT_DEFAULT || object->type == OBJT_SWAP)) { - vm_object_collapse(object); - vm_object_page_remove(object, offidxstart, offidxend, FALSE); - if (object->type == OBJT_SWAP) - swap_pager_freespace(object, offidxstart, count); - if (offidxend >= object->size && - offidxstart < object->size) - object->size = offidxstart; - } - VM_OBJECT_UNLOCK(object); + if (object->ref_count != 1 && + ((object->flags & (OBJ_NOSPLIT|OBJ_ONEMAPPING)) == OBJ_ONEMAPPING || + object == kernel_object || object == kmem_object) && + (object->type == OBJT_DEFAULT || object->type == OBJT_SWAP)) { + vm_object_collapse(object); + vm_object_page_remove(object, offidxstart, offidxend, FALSE); + if (object->type == OBJT_SWAP) + swap_pager_freespace(object, offidxstart, count); + if (offidxend >= object->size && + offidxstart < object->size) + object->size = offidxstart; } - mtx_unlock(&Giant); + VM_OBJECT_UNLOCK(object); } + mtx_unlock(&Giant); /* * Delete the entry (which may delete the object) only after