uvm_pagefree: when orphaning an A->K loaned page,

- decrement uvmexp.anonpages as it's no longer an anon page.
	- null out anon->u.an_page as the anon no longer own the page.
uvm_anfree: add related assertions.
This commit is contained in:
yamt 2004-09-01 11:53:38 +00:00
parent 23c60dbfe0
commit 175e99933e
2 changed files with 9 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_anon.c,v 1.30 2004/09/01 10:09:26 yamt Exp $ */
/* $NetBSD: uvm_anon.c,v 1.31 2004/09/01 11:53:38 yamt Exp $ */
/*
*
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.30 2004/09/01 10:09:26 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.31 2004/09/01 11:53:38 yamt Exp $");
#include "opt_uvmhist.h"
@ -279,6 +279,9 @@ uvm_anfree(anon)
* free the anon itself.
*/
KASSERT(anon->u.an_page == NULL);
KASSERT(anon->an_swslot == 0);
simple_lock(&uvm.afreelock);
anon->u.an_nxt = uvm.afree;
uvm.afree = anon;

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_page.c,v 1.98 2004/05/05 11:58:27 yamt Exp $ */
/* $NetBSD: uvm_page.c,v 1.99 2004/09/01 11:53:38 yamt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.98 2004/05/05 11:58:27 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.99 2004/09/01 11:53:38 yamt Exp $");
#include "opt_uvmhist.h"
@ -1360,7 +1360,9 @@ uvm_pagefree(pg)
pg->loan_count--;
} else {
pg->pqflags &= ~PQ_ANON;
uvmexp.anonpages--;
}
pg->uanon->u.an_page = NULL;
pg->uanon = NULL;
}
if (pg->flags & PG_WANTED) {