Paul Kranenburg's VM deadlock patches (from patchkit 00147, parts 3 & 4).

Prevent dirty objects from being cached, and prevent vm_page_alloc() from
allocating too much memory to non-kernel objects.
This commit is contained in:
andrew 1993-06-30 03:48:25 +00:00
parent 112b578662
commit 7a0e26cd13
2 changed files with 31 additions and 2 deletions

View File

@ -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.

View File

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