Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm A few assertions & comments.



details:   https://anonhg.NetBSD.org/src/rev/dda01b1b555d
branches:  trunk
changeset: 751398:dda01b1b555d
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Wed Feb 03 14:02:49 2010 +0000

description:
A few assertions & comments.

diffstat:

 sys/uvm/uvm_loan.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (60 lines):

diff -r 9365c6c2c40c -r dda01b1b555d sys/uvm/uvm_loan.c
--- a/sys/uvm/uvm_loan.c        Wed Feb 03 13:56:53 2010 +0000
+++ b/sys/uvm/uvm_loan.c        Wed Feb 03 14:02:49 2010 +0000
@@ -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);
        }



Home | Main Index | Thread Index | Old Index