From 0891ef4c9a9749e075fad1b5fdffd82b1306601b Mon Sep 17 00:00:00 2001 From: John Dyson Date: Wed, 24 Apr 1996 04:16:45 +0000 Subject: [PATCH] This fixes kmem_malloc/kmem_free (and malloc/free of objects of > 8K). A page index was calculated incorrectly in vm_kern, and vm_object_page_remove removed pages that should not have been. --- sys/vm/vm_kern.c | 4 ++-- sys/vm/vm_object.c | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 35eae4fcb517..dcefdc04ec66 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_kern.c,v 1.21 1996/01/19 03:59:48 dyson Exp $ + * $Id: vm_kern.c,v 1.22 1996/01/31 12:05:52 davidg Exp $ */ /* @@ -314,7 +314,7 @@ kmem_malloc(map, size, waitflag) panic("kmem_malloc: kmem_map too small"); return (0); } - offset = addr - vm_map_min(kmem_map); + offset = addr - VM_MIN_KERNEL_ADDRESS; vm_object_reference(kmem_object); vm_map_insert(map, kmem_object, offset, addr, addr + size, VM_PROT_ALL, VM_PROT_ALL, 0); diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index e7c19ce4e4f8..6b180ae013ff 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.66 1996/03/28 04:53:26 dyson Exp $ + * $Id: vm_object.c,v 1.67 1996/03/29 06:28:48 davidg Exp $ */ /* @@ -1162,12 +1162,14 @@ vm_object_page_remove(object, start, end, clean_only) if (size > 4 || size >= object->size / 4) { for (p = object->memq.tqh_first; p != NULL; p = next) { next = p->listq.tqe_next; - if (p->wire_count != 0) { - vm_page_protect(p, VM_PROT_NONE); - p->valid = 0; - continue; - } if ((start <= p->pindex) && (p->pindex < end)) { + + if (p->wire_count != 0) { + vm_page_protect(p, VM_PROT_NONE); + p->valid = 0; + continue; + } + s = splhigh(); if ((p->flags & PG_BUSY) || p->busy) { p->flags |= PG_WANTED; @@ -1176,6 +1178,7 @@ vm_object_page_remove(object, start, end, clean_only) goto again; } splx(s); + if (clean_only) { vm_page_test_dirty(p); if (p->valid & p->dirty)