diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 61325dedd32d..1c01709e701d 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_object.c 7.4 (Berkeley) 5/7/91 - * $Id: vm_object.c,v 1.3 1993/05/20 03:59:35 cgd Exp $ + * $Id: vm_object.c,v 1.4 1993/06/30 03:48:26 andrew Exp $ * * * Copyright (c) 1987, 1990 Carnegie-Mellon University. @@ -249,6 +249,26 @@ void vm_object_deallocate(object) */ if (object->can_persist) { + register vm_page_t p; + + /* + * Check for dirty pages in object + * Print warning as this may signify kernel bugs + * pk@cs.few.eur.nl - 4/15/93 + */ + p = (vm_page_t) queue_first(&object->memq); + while (!queue_end(&object->memq, (queue_entry_t) p)) { + VM_PAGE_CHECK(p); + + if (pmap_is_modified(VM_PAGE_TO_PHYS(p)) || + !p->clean) { + + printf("vm_object_dealloc: persistent object %x isn't clean\n", object); + goto cant_persist; + } + + p = (vm_page_t) queue_next(&p->listq); + } queue_enter(&vm_object_cached_list, object, vm_object_t, cached_list); @@ -261,6 +281,7 @@ void vm_object_deallocate(object) vm_object_cache_trim(); return; } + cant_persist:; /* * Make sure no one can look us up now. diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 3f19dd74fe0e..1add5abc262a 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91 - * $Id: vm_page.c,v 1.4 1993/05/20 03:59:37 cgd Exp $ + * $Id: vm_page.c,v 1.5 1993/06/30 03:48:25 andrew Exp $ * * * Copyright (c) 1987, 1990 Carnegie-Mellon University. @@ -548,6 +548,14 @@ vm_page_t vm_page_alloc(object, offset) spl = splimp(); /* XXX */ simple_lock(&vm_page_queue_free_lock); + if ( object != kernel_object && + object != kmem_object && + vm_page_free_count <= vm_page_free_reserved) { + + simple_unlock(&vm_page_queue_free_lock); + splx(spl); + return(NULL); + } if (queue_empty(&vm_page_queue_free)) { simple_unlock(&vm_page_queue_free_lock); splx(spl);