diff options
author | alc <alc@FreeBSD.org> | 1999-04-04 07:11:02 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 1999-04-04 07:11:02 +0000 |
commit | ad1fbba2a904f36f2f99e3cd4eb626f2561c8360 (patch) | |
tree | e5fc2dc5e9a9792f12f035a96c2400dbd17f7735 /sys | |
parent | d352c9407063818d7ca027fe7d37282636d7fd71 (diff) | |
download | FreeBSD-src-ad1fbba2a904f36f2f99e3cd4eb626f2561c8360.zip FreeBSD-src-ad1fbba2a904f36f2f99e3cd4eb626f2561c8360.tar.gz |
Two changes to vm_map_delete:
1. Don't bother checking object->ref_count == 1 in order to set
OBJ_ONEMAPPING. It's a waste of time. If object->ref_count == 1,
vm_map_entry_delete will "run-down" the object and its pages.
2. If object->ref_count == 1, ignore OBJ_ONEMAPPING. Wait for
vm_map_entry_delete to "run-down" the object and its pages.
Otherwise, we're calling two different procedures to delete
the object's pages.
Note: "vmstat -s" will once again show a non-zero value
for "pages freed by exiting processes".
Diffstat (limited to 'sys')
-rw-r--r-- | sys/vm/vm_map.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 84dd7d2..f065a80 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_map.c,v 1.158 1999/03/21 23:37:00 alc Exp $ + * $Id: vm_map.c,v 1.159 1999/03/27 23:46:04 alc Exp $ */ /* @@ -1917,12 +1917,9 @@ vm_map_delete(map, start, end) * Find the start of the region, and clip it */ - if (!vm_map_lookup_entry(map, start, &first_entry)) { + if (!vm_map_lookup_entry(map, start, &first_entry)) entry = first_entry->next; - object = entry->object.vm_object; - if (object && (object->ref_count == 1) && (object->shadow_count == 0)) - vm_object_set_flag(object, OBJ_ONEMAPPING); - } else { + else { entry = first_entry; vm_map_clip_start(map, entry, start); /* @@ -1975,18 +1972,18 @@ vm_map_delete(map, start, end) vm_object_page_remove(object, offidxstart, offidxend, FALSE); } else { pmap_remove(map->pmap, s, e); - if (object && - ((object->flags & (OBJ_NOSPLIT|OBJ_ONEMAPPING)) == OBJ_ONEMAPPING) && - ((object->type == OBJT_SWAP) || (object->type == OBJT_DEFAULT))) { + 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); 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 (offidxend >= object->size && + offidxstart < object->size) { + object->size = offidxstart; } } } |