diff options
author | alc <alc@FreeBSD.org> | 2003-04-30 19:18:09 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-04-30 19:18:09 +0000 |
commit | 6d3db5a963b7c8bdf84d0ec416c3bb828457e6fa (patch) | |
tree | 15cc43a6e7b637d9f97933c9243be0695f2b1f28 /sys | |
parent | 75fd435e27c35ac151ded91ff1d35e3cf27fc121 (diff) | |
download | FreeBSD-src-6d3db5a963b7c8bdf84d0ec416c3bb828457e6fa.zip FreeBSD-src-6d3db5a963b7c8bdf84d0ec416c3bb828457e6fa.tar.gz |
Increase the scope of the vm_object lock in vm_map_delete().
Diffstat (limited to 'sys')
-rw-r--r-- | sys/vm/vm_map.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 38fe0e2..1af2f1b 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -2138,19 +2138,20 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offset_t end) vm_page_lock_queues(); pmap_remove(map->pmap, s, e); vm_page_unlock_queues(); - if (object != NULL && - object->ref_count != 1 && - (object->flags & (OBJ_NOSPLIT|OBJ_ONEMAPPING)) == OBJ_ONEMAPPING && - (object->type == OBJT_DEFAULT || object->type == OBJT_SWAP)) { - vm_object_collapse(object); + if (object != NULL) { VM_OBJECT_LOCK(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; + if (object->ref_count != 1 && + (object->flags & (OBJ_NOSPLIT|OBJ_ONEMAPPING)) == OBJ_ONEMAPPING && + (object->type == OBJT_DEFAULT || object->type == OBJT_SWAP)) { + VM_OBJECT_UNLOCK(object); + vm_object_collapse(object); + VM_OBJECT_LOCK(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); } |