Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Don't pass an unnecessary reference to uvm_loanbreak...



details:   https://anonhg.NetBSD.org/src/rev/ee8baa887e2b
branches:  trunk
changeset: 751375:ee8baa887e2b
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Tue Feb 02 17:40:43 2010 +0000

description:
Don't pass an unnecessary reference to uvm_loanbreak_anon().

Requested by rmind@.

diffstat:

 sys/uvm/uvm_fault.c |   9 ++++++---
 sys/uvm/uvm_loan.c  |  13 ++++++-------
 sys/uvm/uvm_loan.h  |   4 ++--
 3 files changed, 14 insertions(+), 12 deletions(-)

diffs (101 lines):

diff -r 3b2e1fef8294 -r ee8baa887e2b sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Tue Feb 02 16:54:40 2010 +0000
+++ b/sys/uvm/uvm_fault.c       Tue Feb 02 17:40:43 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.154 2010/02/02 06:52:59 uebayasi Exp $ */
+/*     $NetBSD: uvm_fault.c,v 1.155 2010/02/02 17:40:43 uebayasi Exp $ */
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.154 2010/02/02 06:52:59 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.155 2010/02/02 17:40:43 uebayasi Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1493,12 +1493,15 @@
 
                /* >1 case is already ok */
                if (anon->an_ref == 1) {
-                       error = uvm_loanbreak_anon(anon, ruobj);
+                       error = uvm_loanbreak_anon(anon, *ruobj);
                        if (error != 0) {
                                uvmfault_unlockall(ufi, amap, *ruobj, anon);
                                uvm_wait("flt_noram2");
                                return ERESTART;
                        }
+                       /* if we were a loan reciever uobj is gone */
+                       if (*ruobj)
+                               *ruobj = NULL;
                }
        }
        return error;
diff -r 3b2e1fef8294 -r ee8baa887e2b sys/uvm/uvm_loan.c
--- a/sys/uvm/uvm_loan.c        Tue Feb 02 16:54:40 2010 +0000
+++ b/sys/uvm/uvm_loan.c        Tue Feb 02 17:40:43 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_loan.c,v 1.75 2010/02/02 06:06:02 uebayasi Exp $   */
+/*     $NetBSD: uvm_loan.c,v 1.76 2010/02/02 17:40:43 uebayasi Exp $   */
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.75 2010/02/02 06:06:02 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.76 2010/02/02 17:40:43 uebayasi Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1184,7 +1184,7 @@
 }
 
 int
-uvm_loanbreak_anon(struct vm_anon *anon, struct uvm_object **ruobj)
+uvm_loanbreak_anon(struct vm_anon *anon, struct uvm_object *uobj)
 {
        struct vm_page *pg;
 
@@ -1209,7 +1209,7 @@
        /* in case we owned */
        anon->an_page->pqflags &= ~PQ_ANON;
 
-       if (*ruobj) {
+       if (uobj) {
                /* if we were receiver of loan */
                anon->an_page->loan_count--;
        } else {
@@ -1220,9 +1220,8 @@
                uvm_pagedequeue(anon->an_page);
        }
 
-       if (*ruobj) {
-               mutex_exit(&(*ruobj)->vmobjlock);
-               *ruobj = NULL;
+       if (uobj) {
+               mutex_exit(&uobj->vmobjlock);
        }
 
        /* install new page in anon */
diff -r 3b2e1fef8294 -r ee8baa887e2b sys/uvm/uvm_loan.h
--- a/sys/uvm/uvm_loan.h        Tue Feb 02 16:54:40 2010 +0000
+++ b/sys/uvm/uvm_loan.h        Tue Feb 02 17:40:43 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_loan.h,v 1.15 2010/02/02 06:06:02 uebayasi Exp $   */
+/*     $NetBSD: uvm_loan.h,v 1.16 2010/02/02 17:40:43 uebayasi Exp $   */
 
 /*
  *
@@ -56,7 +56,7 @@
 int uvm_loanuobjpages(struct uvm_object *, voff_t, int,
     struct vm_page **);
 struct vm_page *uvm_loanbreak(struct vm_page *);
-int uvm_loanbreak_anon(struct vm_anon *, struct uvm_object **);
+int uvm_loanbreak_anon(struct vm_anon *, struct uvm_object *);
 
 #endif /* _KERNEL */
 



Home | Main Index | Thread Index | Old Index