Module Name: src Committed By: uebayasi Date: Wed Feb 3 14:02:49 UTC 2010
Modified Files: src/sys/uvm: uvm_loan.c Log Message: A few assertions & comments. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/uvm/uvm_loan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/uvm/uvm_loan.c diff -u src/sys/uvm/uvm_loan.c:1.76 src/sys/uvm/uvm_loan.c:1.77 --- src/sys/uvm/uvm_loan.c:1.76 Tue Feb 2 17:40:43 2010 +++ src/sys/uvm/uvm_loan.c Wed Feb 3 14:02:49 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_loan.c,v 1.76 2010/02/02 17:40:43 uebayasi Exp $ */ +/* $NetBSD: uvm_loan.c,v 1.77 2010/02/03 14:02:49 uebayasi Exp $ */ /* * @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.76 2010/02/02 17:40:43 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.77 2010/02/03 14:02:49 uebayasi Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -638,7 +638,10 @@ * XXXCDC: duplicate code with uvm_fault(). */ + /* locked: maps(read), amap(if there) */ mutex_enter(&uobj->vmobjlock); + /* locked: maps(read), amap(if there), uobj */ + if (uobj->pgops->pgo_get) { /* try locked pgo_get */ npages = 1; pg = NULL; @@ -1188,6 +1191,9 @@ { struct vm_page *pg; + KASSERT(mutex_owned(&anon->an_lock)); + KASSERT(uobj == NULL || mutex_owned(&uobj->vmobjlock)); + /* get new un-owned replacement page */ pg = uvm_pagealloc(NULL, 0, NULL, 0); if (pg == NULL) { @@ -1195,8 +1201,7 @@ } /* - * copy data, kill loan, and drop uobj lock - * (if any) + * copy data, kill loan, and drop uobj lock (if any) */ /* copy old -> new */ uvm_pagecopy(anon->an_page, pg); @@ -1214,8 +1219,8 @@ anon->an_page->loan_count--; } else { /* - * we were the lender (A->K); need - * to remove the page from pageq's. + * we were the lender (A->K); need to remove the page from + * pageq's. */ uvm_pagedequeue(anon->an_page); }