Work around some VM bugs, the worst being an overly aggressive

swap space free calculation.  More complete fixes will be forthcoming,
in a week.
This commit is contained in:
John Dyson 1998-05-04 03:01:44 +00:00
parent b1dd8a7b57
commit cbd8ec0902
4 changed files with 44 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/* $Id: sysv_shm.c,v 1.34 1998/02/09 06:09:25 eivind Exp $ */
/* $Id: sysv_shm.c,v 1.35 1998/03/30 09:50:46 phk Exp $ */
/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */
/*
@ -145,6 +145,7 @@ shm_deallocate_segment(shmseg)
size_t size;
shm_handle = shmseg->shm_internal;
shm_handle->shm_object->shadow_count--;
vm_object_deallocate(shm_handle->shm_object);
free((caddr_t)shm_handle, M_SHM);
shmseg->shm_internal = NULL;
@ -503,6 +504,9 @@ shmget_allocate_segment(p, uap, mode)
shm_handle->shm_object =
vm_pager_allocate(OBJT_SWAP, 0, OFF_TO_IDX(size),
VM_PROT_DEFAULT, 0);
shm_handle->shm_object->shadow_count++;
shm_handle->shm_object->flags &= ~OBJ_ONEMAPPING;
shmseg->shm_internal = shm_handle;
shmseg->shm_perm.cuid = shmseg->shm_perm.uid = cred->cr_uid;
shmseg->shm_perm.cgid = shmseg->shm_perm.gid = cred->cr_gid;

View File

@ -39,7 +39,7 @@
* from: Utah $Hdr: swap_pager.c 1.4 91/04/30$
*
* @(#)swap_pager.c 8.9 (Berkeley) 3/21/94
* $Id: swap_pager.c,v 1.93 1998/04/15 17:47:35 bde Exp $
* $Id: swap_pager.c,v 1.94 1998/04/29 04:27:59 dyson Exp $
*/
/*
@ -631,7 +631,8 @@ swap_pager_reclaim()
*/
void
swap_pager_copy(srcobject, srcoffset, dstobject, dstoffset, offset, destroysource)
swap_pager_copy(srcobject, srcoffset, dstobject, dstoffset,
offset, destroysource)
vm_object_t srcobject;
vm_pindex_t srcoffset;
vm_object_t dstobject;
@ -651,10 +652,12 @@ swap_pager_copy(srcobject, srcoffset, dstobject, dstoffset, offset, destroysourc
/*
* remove the source object from the swap_pager internal queue
*/
if (srcobject->handle == NULL) {
TAILQ_REMOVE(&swap_pager_un_object_list, srcobject, pager_object_list);
} else {
TAILQ_REMOVE(&swap_pager_object_list, srcobject, pager_object_list);
if (destroysource) {
if (srcobject->handle == NULL) {
TAILQ_REMOVE(&swap_pager_un_object_list, srcobject, pager_object_list);
} else {
TAILQ_REMOVE(&swap_pager_object_list, srcobject, pager_object_list);
}
}
s = splvm();
@ -673,8 +676,8 @@ swap_pager_copy(srcobject, srcoffset, dstobject, dstoffset, offset, destroysourc
*/
for (i = 0; i < dstobject->size; i += 1) {
int srcvalid, dstvalid;
daddr_t *srcaddrp = swap_pager_diskaddr(srcobject, i + offset + srcoffset,
&srcvalid);
daddr_t *srcaddrp = swap_pager_diskaddr(srcobject,
i + offset + srcoffset, &srcvalid);
daddr_t *dstaddrp;
/*

View File

@ -66,7 +66,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_fault.c,v 1.81 1998/03/01 04:18:18 dyson Exp $
* $Id: vm_fault.c,v 1.82 1998/03/07 20:45:47 dyson Exp $
*/
/*
@ -606,7 +606,8 @@ RetryFault:;
*/
vm_page_rename(fs.m, fs.first_object, fs.first_pindex);
fs.first_m = fs.m;
fs.m->dirty = VM_PAGE_BITS_ALL;
fs.first_m->dirty = VM_PAGE_BITS_ALL;
fs.first_m->flags |= PG_BUSY;
fs.m = NULL;
cnt.v_cow_optim++;
} else {

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.122 1998/05/01 02:25:29 dyson Exp $
* $Id: vm_map.c,v 1.123 1998/05/02 06:36:16 dyson Exp $
*/
/*
@ -541,6 +541,13 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
new_entry->eflags = protoeflags;
new_entry->object.vm_object = object;
new_entry->offset = offset;
if (object) {
if ((object->ref_count > 1) || (object->shadow_count != 0)) {
object->flags &= ~OBJ_ONEMAPPING;
} else {
object->flags |= OBJ_ONEMAPPING;
}
}
if (map->is_main_map) {
new_entry->inheritance = VM_INHERIT_DEFAULT;
@ -1751,6 +1758,7 @@ vm_map_delete(map, start, end)
vm_offset_t start;
vm_offset_t end;
{
vm_object_t object;
vm_map_entry_t entry;
vm_map_entry_t first_entry;
@ -1760,9 +1768,9 @@ vm_map_delete(map, start, end)
if (!vm_map_lookup_entry(map, start, &first_entry)) {
entry = first_entry->next;
if (entry->object.vm_object &&
(entry->object.vm_object->ref_count == 1))
entry->object.vm_object->flags |= OBJ_ONEMAPPING;
object = entry->object.vm_object;
if (object && (object->ref_count == 1) && (object->shadow_count == 0))
object->flags |= OBJ_ONEMAPPING;
} else {
entry = first_entry;
vm_map_clip_start(map, entry, start);
@ -1790,20 +1798,17 @@ vm_map_delete(map, start, end)
while ((entry != &map->header) && (entry->start < end)) {
vm_map_entry_t next;
vm_offset_t s, e;
vm_object_t object;
vm_pindex_t offidxstart, offidxend;
vm_ooffset_t offset;
vm_pindex_t offidxstart, offidxend, count;
vm_map_clip_end(map, entry, end);
offset = entry->offset;
s = entry->start;
e = entry->end;
next = entry->next;
object = entry->object.vm_object;
offidxstart = OFF_TO_IDX(offset);
offidxend = offidxstart + OFF_TO_IDX(e - s);
offidxstart = OFF_TO_IDX(entry->offset);
count = OFF_TO_IDX(e - s);
object = entry->object.vm_object;
/*
* Unwire before removing addresses from the pmap; otherwise,
@ -1813,6 +1818,7 @@ vm_map_delete(map, start, end)
vm_map_entry_unwire(map, entry);
}
offidxend = offidxstart + count;
/*
* If this is a sharing map, we must remove *all* references
* to this data, since we can't find all of the physical maps
@ -1831,10 +1837,12 @@ vm_map_delete(map, start, end)
vm_object_collapse(object);
vm_object_page_remove(object, offidxstart, offidxend, FALSE);
if (object->type == OBJT_SWAP) {
swap_pager_freespace(object, offidxstart, offidxend);
swap_pager_freespace(object, offidxstart, count);
}
if (object->size <= offidxend) {
object->size = offidxstart;
if ((offidxend >= object->size) &&
(offidxstart < object->size)) {
object->size = offidxstart;
}
}
}
@ -2045,6 +2053,7 @@ vm_map_copy_entry(src_map, dst_map, src_entry, dst_entry)
vm_object_collapse(src_object);
if (src_object->flags & OBJ_ONEMAPPING) {
vm_map_split(src_entry);
src_map->timestamp++;
src_object = src_entry->object.vm_object;
}
}
@ -2120,7 +2129,6 @@ vmspace_fork(vm1)
if (object == NULL) {
object = vm_object_allocate(OBJT_DEFAULT,
atop(old_entry->end - old_entry->start));
object->flags &= ~OBJ_ONEMAPPING;
old_entry->object.vm_object = object;
old_entry->offset = (vm_offset_t) 0;
} else if (old_entry->eflags & MAP_ENTRY_NEEDS_COPY) {
@ -2130,6 +2138,7 @@ vmspace_fork(vm1)
old_entry->eflags &= ~MAP_ENTRY_NEEDS_COPY;
object = old_entry->object.vm_object;
}
object->flags &= ~OBJ_ONEMAPPING;
/*
* Clone the entry, referencing the sharing map.
@ -2177,6 +2186,7 @@ vmspace_fork(vm1)
new_map->size = old_map->size;
vm_map_unlock(old_map);
old_map->timestamp++;
return (vm2);
}