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.
This commit is contained in:
Alan Cox 1999-05-16 05:07:34 +00:00
parent 54746b676c
commit ea41812fe5
4 changed files with 22 additions and 28 deletions

View File

@ -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.160 1999/04/04 07:11:02 alc Exp $
* $Id: vm_map.c,v 1.161 1999/05/14 23:09:32 alc Exp $
*/
/*
@ -1231,9 +1231,8 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_offset_t end,
* system call.
*/
void
vm_map_madvise(map, pmap, start, end, advise)
vm_map_madvise(map, start, end, advise)
vm_map_t map;
pmap_t pmap;
vm_offset_t start, end;
int advise;
{
@ -1311,7 +1310,7 @@ vm_map_madvise(map, pmap, start, end, advise)
count = OFF_TO_IDX(size);
vm_object_madvise(current->object.vm_object,
pindex, count, advise);
pmap_object_init_pt(pmap, current->start,
pmap_object_init_pt(map->pmap, current->start,
current->object.vm_object, pindex,
(count << PAGE_SHIFT), 0);
}
@ -2731,9 +2730,7 @@ vm_uiomove(mapa, srcobject, cp, cnta, uaddra, npages)
/*
* Remove unneeded old pages
*/
if (first_object->resident_page_count) {
vm_object_page_remove (first_object, 0, 0, 0);
}
vm_object_page_remove(first_object, 0, 0, 0);
/*
* Invalidate swap space

View File

@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_map.h,v 1.38 1999/03/06 07:11:33 alc Exp $
* $Id: vm_map.h,v 1.39 1999/05/14 23:09:34 alc Exp $
*/
/*
@ -342,12 +342,10 @@ int vm_map_pageable __P((vm_map_t, vm_offset_t, vm_offset_t, boolean_t));
int vm_map_user_pageable __P((vm_map_t, vm_offset_t, vm_offset_t, boolean_t));
int vm_map_clean __P((vm_map_t, vm_offset_t, vm_offset_t, boolean_t, boolean_t));
int vm_map_protect __P((vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t));
void vm_map_reference __P((vm_map_t));
int vm_map_remove __P((vm_map_t, vm_offset_t, vm_offset_t));
void vm_map_simplify __P((vm_map_t, vm_offset_t));
void vm_map_startup __P((void));
int vm_map_submap __P((vm_map_t, vm_offset_t, vm_offset_t, vm_map_t));
void vm_map_madvise __P((vm_map_t, pmap_t, vm_offset_t, vm_offset_t, int));
void vm_map_madvise __P((vm_map_t, vm_offset_t, vm_offset_t, int));
void vm_map_simplify_entry __P((vm_map_t, vm_map_entry_t));
void vm_init2 __P((void));
int vm_uiomove __P((vm_map_t, vm_object_t, off_t, int, vm_offset_t, int *));

View File

@ -38,7 +38,7 @@
* from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$
*
* @(#)vm_mmap.c 8.4 (Berkeley) 1/12/94
* $Id: vm_mmap.c,v 1.96 1999/05/06 22:06:45 peter Exp $
* $Id: vm_mmap.c,v 1.97 1999/05/14 23:09:34 alc Exp $
*/
/*
@ -616,8 +616,6 @@ madvise(p, uap)
struct proc *p;
struct madvise_args *uap;
{
vm_map_t map;
pmap_t pmap;
vm_offset_t start, end;
/*
* Check for illegal addresses. Watch out for address wrap... Note
@ -640,10 +638,7 @@ madvise(p, uap)
start = trunc_page((vm_offset_t) uap->addr);
end = round_page((vm_offset_t) uap->addr + uap->len);
map = &p->p_vmspace->vm_map;
pmap = vmspace_pmap(p->p_vmspace);
vm_map_madvise(map, pmap, start, end, uap->behav);
vm_map_madvise(&p->p_vmspace->vm_map, start, end, uap->behav);
return (0);
}

View File

@ -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);
}