From 68af6d169be8c11883e9a480bea2662059338c39 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 24 Jan 1999 06:00:31 +0000 Subject: [PATCH] vm_map_split() used to dirty the page manually after calling vm_page_rename(), but never pulled the page off PQ_CACHE if it was on PQ_CACHE. Dirty pages in PQ_CACHE are not allowed and a KASSERT was added in -4.x to test for this... and got hit. In -4.x, vm_page_rename() automatically dirties the page. This commit also has it deal with the PQ_CACHE case, deactivating the page in that case. --- sys/vm/vm_page.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 5b507895a103..c4531d87d0f5 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.119 1999/01/24 01:04:04 dillon Exp $ + * $Id: vm_page.c,v 1.120 1999/01/24 02:29:26 dillon Exp $ */ /* @@ -590,7 +590,9 @@ retry: * * Note: we *always* dirty the page. It is necessary both for the * fact that we moved it, and because we may be invalidating - * swap. + * swap. If the page is on the cache, we have to deactivate it + * or vm_page_dirty() will panic. Dirty pages are not allowed + * on the cache. */ void @@ -604,7 +606,9 @@ vm_page_rename(m, new_object, new_pindex) s = splvm(); vm_page_remove(m); vm_page_insert(m, new_object, new_pindex); - m->dirty = VM_PAGE_BITS_ALL; + if (m->queue - m->pc == PQ_CACHE) + vm_page_deactivate(m); + vm_page_dirty(m); splx(s); } @@ -1448,6 +1452,11 @@ vm_page_wire(m) * processes. This optimization causes one-time-use metadata to be * reused more quickly. * + * A number of routines use vm_page_unwire() to guarentee that the page + * will go into either the inactive or active queues, and will NEVER + * be placed in the cache - for example, just after dirtying a page. + * dirty pages in the cache are not allowed. + * * The page queues must be locked. * This routine may not block. */ @@ -1697,7 +1706,7 @@ vm_page_test_dirty(m) { if ((m->dirty != VM_PAGE_BITS_ALL) && pmap_is_modified(VM_PAGE_TO_PHYS(m))) { - m->dirty = VM_PAGE_BITS_ALL; + vm_page_dirty(m); } }