diff options
author | alc <alc@FreeBSD.org> | 1999-05-16 05:07:34 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 1999-05-16 05:07:34 +0000 |
commit | 83a986307949a6c85689d8dc8ae7e610f6eaa789 (patch) | |
tree | 563367a37b36736593c85d0280e464ae1bbf69fa /sys/vm/vm_object.c | |
parent | c936e75142d61c8479a937a68163a5ad73bd2ef0 (diff) | |
download | FreeBSD-src-83a986307949a6c85689d8dc8ae7e610f6eaa789.zip FreeBSD-src-83a986307949a6c85689d8dc8ae7e610f6eaa789.tar.gz |
Remove prototypes for functions that don't exist anymore (vm_map.h).
Remove a useless argument from vm_map_madvise's interface (vm_map.c,
vm_map.h, and vm_mmap.c).
Remove a redundant test in vm_uiomove (vm_map.c).
Make two changes to vm_object_coalesce:
1. Determine whether the new range of pages actually overlaps
the existing object's range of pages before calling vm_object_page_remove.
(Prior to this change almost 90% of the calls to vm_object_page_remove
were to remove pages that were beyond the end of the object.)
2. Free any swap space allocated to removed pages.
Diffstat (limited to 'sys/vm/vm_object.c')
-rw-r--r-- | sys/vm/vm_object.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 398e3de..e53756a 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_object.c,v 1.152 1999/02/24 21:26:26 dillon Exp $ + * $Id: vm_object.c,v 1.153 1999/03/14 06:36:00 alc Exp $ */ /* @@ -1453,7 +1453,7 @@ vm_object_coalesce(prev_object, prev_pindex, prev_size, next_size) vm_pindex_t prev_pindex; vm_size_t prev_size, next_size; { - vm_size_t newsize; + vm_pindex_t next_pindex; if (prev_object == NULL) { return (TRUE); @@ -1481,9 +1481,10 @@ vm_object_coalesce(prev_object, prev_pindex, prev_size, next_size) prev_size >>= PAGE_SHIFT; next_size >>= PAGE_SHIFT; + next_pindex = prev_pindex + prev_size; if ((prev_object->ref_count > 1) && - (prev_object->size != prev_pindex + prev_size)) { + (prev_object->size != next_pindex)) { return (FALSE); } @@ -1491,17 +1492,20 @@ vm_object_coalesce(prev_object, prev_pindex, prev_size, next_size) * Remove any pages that may still be in the object from a previous * deallocation. */ - - vm_object_page_remove(prev_object, - prev_pindex + prev_size, - prev_pindex + prev_size + next_size, FALSE); + if (next_pindex < prev_object->size) { + vm_object_page_remove(prev_object, + next_pindex, + next_pindex + next_size, FALSE); + if (prev_object->type == OBJT_SWAP) + swap_pager_freespace(prev_object, + next_pindex, next_size); + } /* * Extend the object if necessary. */ - newsize = prev_pindex + prev_size + next_size; - if (newsize > prev_object->size) - prev_object->size = newsize; + if (next_pindex + next_size > prev_object->size) + prev_object->size = next_pindex + next_size; return (TRUE); } |