Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Indent.



details:   https://anonhg.NetBSD.org/src/rev/1cb8e5f531e7
branches:  trunk
changeset: 751354:1cb8e5f531e7
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Mon Feb 01 16:12:36 2010 +0000

description:
Indent.

diffstat:

 sys/uvm/uvm_fault.c |  647 +++++++++++++++++++++++++--------------------------
 1 files changed, 323 insertions(+), 324 deletions(-)

diffs (truncated from 757 to 300 lines):

diff -r fc038f65e856 -r 1cb8e5f531e7 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Mon Feb 01 16:08:27 2010 +0000
+++ b/sys/uvm/uvm_fault.c       Mon Feb 01 16:12:36 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.148 2010/02/01 16:08:27 uebayasi Exp $ */
+/*     $NetBSD: uvm_fault.c,v 1.149 2010/02/01 16:12:36 uebayasi Exp $ */
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.148 2010/02/01 16:08:27 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.149 2010/02/01 16:12:36 uebayasi Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1424,92 +1424,91 @@
        struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
        struct vm_anon *anon, struct uvm_object **ruobj)
 {
-               struct vm_amap * const amap = ufi->entry->aref.ar_amap;
-               struct uvm_object *uobj = *ruobj;
+       struct vm_amap * const amap = ufi->entry->aref.ar_amap;
+       struct uvm_object *uobj = *ruobj;
+
+       if (!flt->cow_now) {
+
+               /*
+                * for read faults on loaned pages we just cap the
+                * protection at read-only.
+                */
+
+               flt->enter_prot = flt->enter_prot & ~VM_PROT_WRITE;
 
-               if (!flt->cow_now) {
+       } else {
+               /*
+                * note that we can't allow writes into a loaned page!
+                *
+                * if we have a write fault on a loaned page in an
+                * anon then we need to look at the anon's ref count.
+                * if it is greater than one then we are going to do
+                * a normal copy-on-write fault into a new anon (this
+                * is not a problem).  however, if the reference count
+                * is one (a case where we would normally allow a
+                * write directly to the page) then we need to kill
+                * the loan before we continue.
+                */
+
+               /* >1 case is already ok */
+               if (anon->an_ref == 1) {
+                       struct vm_page *pg;
+
+                       /* get new un-owned replacement page */
+                       pg = uvm_pagealloc(NULL, 0, NULL, 0);
+                       if (pg == NULL) {
+                               uvmfault_unlockall(ufi, amap, uobj, anon);
+                               uvm_wait("flt_noram2");
+                               return ERESTART;
+                       }
 
                        /*
-                        * for read faults on loaned pages we just cap the
-                        * protection at read-only.
+                        * copy data, kill loan, and drop uobj lock
+                        * (if any)
                         */
-
-                       flt->enter_prot = flt->enter_prot & ~VM_PROT_WRITE;
-
-               } else {
-                       /*
-                        * note that we can't allow writes into a loaned page!
-                        *
-                        * if we have a write fault on a loaned page in an
-                        * anon then we need to look at the anon's ref count.
-                        * if it is greater than one then we are going to do
-                        * a normal copy-on-write fault into a new anon (this
-                        * is not a problem).  however, if the reference count
-                        * is one (a case where we would normally allow a
-                        * write directly to the page) then we need to kill
-                        * the loan before we continue.
-                        */
+                       /* copy old -> new */
+                       uvm_pagecopy(anon->an_page, pg);
 
-                       /* >1 case is already ok */
-                       if (anon->an_ref == 1) {
-                               struct vm_page *pg;
+                       /* force reload */
+                       pmap_page_protect(anon->an_page, VM_PROT_NONE);
+                       mutex_enter(&uvm_pageqlock);      /* KILL loan */
 
-                               /* get new un-owned replacement page */
-                               pg = uvm_pagealloc(NULL, 0, NULL, 0);
-                               if (pg == NULL) {
-                                       uvmfault_unlockall(ufi, amap, uobj,
-                                           anon);
-                                       uvm_wait("flt_noram2");
-                                       return ERESTART;
-                               }
-
-                               /*
-                                * copy data, kill loan, and drop uobj lock
-                                * (if any)
-                                */
-                               /* copy old -> new */
-                               uvm_pagecopy(anon->an_page, pg);
+                       anon->an_page->uanon = NULL;
+                       /* in case we owned */
+                       anon->an_page->pqflags &= ~PQ_ANON;
 
-                               /* force reload */
-                               pmap_page_protect(anon->an_page, VM_PROT_NONE);
-                               mutex_enter(&uvm_pageqlock);      /* KILL loan */
-
-                               anon->an_page->uanon = NULL;
-                               /* in case we owned */
-                               anon->an_page->pqflags &= ~PQ_ANON;
+                       if (uobj) {
+                               /* if we were receiver of loan */
+                               anon->an_page->loan_count--;
+                       } else {
+                               /*
+                                * we were the lender (A->K); need
+                                * to remove the page from pageq's.
+                                */
+                               uvm_pagedequeue(anon->an_page);
+                       }
 
-                               if (uobj) {
-                                       /* if we were receiver of loan */
-                                       anon->an_page->loan_count--;
-                               } else {
-                                       /*
-                                        * we were the lender (A->K); need
-                                        * to remove the page from pageq's.
-                                        */
-                                       uvm_pagedequeue(anon->an_page);
-                               }
+                       if (uobj) {
+                               mutex_exit(&uobj->vmobjlock);
+                               *ruobj = NULL;
+                       }
 
-                               if (uobj) {
-                                       mutex_exit(&uobj->vmobjlock);
-                                       *ruobj = NULL;
-                               }
+                       /* install new page in anon */
+                       anon->an_page = pg;
+                       pg->uanon = anon;
+                       pg->pqflags |= PQ_ANON;
 
-                               /* install new page in anon */
-                               anon->an_page = pg;
-                               pg->uanon = anon;
-                               pg->pqflags |= PQ_ANON;
+                       uvm_pageactivate(pg);
+                       mutex_exit(&uvm_pageqlock);
 
-                               uvm_pageactivate(pg);
-                               mutex_exit(&uvm_pageqlock);
-
-                               pg->flags &= ~(PG_BUSY|PG_FAKE);
-                               UVM_PAGE_OWN(pg, NULL);
+                       pg->flags &= ~(PG_BUSY|PG_FAKE);
+                       UVM_PAGE_OWN(pg, NULL);
 
-                               /* done! */
-                       }     /* ref == 1 */
-               }       /* write fault */
+                       /* done! */
+               }     /* ref == 1 */
+       }       /* write fault */
 
-               return 0;
+       return 0;
 }
 
 static int
@@ -1545,41 +1544,41 @@
        struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
        struct uvm_object *uobj, struct vm_anon *anon)
 {
-               struct vm_anon * const oanon = anon;
-               struct vm_page *pg;
-               int error;
+       struct vm_anon * const oanon = anon;
+       struct vm_page *pg;
+       int error;
 
-               UVMHIST_LOG(maphist, "  case 1B: COW fault",0,0,0,0);
-               uvmexp.flt_acow++;
+       UVMHIST_LOG(maphist, "  case 1B: COW fault",0,0,0,0);
+       uvmexp.flt_acow++;
 
-               error = uvmfault_promote(ufi, oanon, PGO_DONTCARE,
-                   &anon, &flt->anon_spare);
-               switch (error) {
-               case 0:
-                       break;
-               case ERESTART:
-                       return ERESTART;
-               default:
-                       return error;
-               }
+       error = uvmfault_promote(ufi, oanon, PGO_DONTCARE,
+           &anon, &flt->anon_spare);
+       switch (error) {
+       case 0:
+               break;
+       case ERESTART:
+               return ERESTART;
+       default:
+               return error;
+       }
 
-               pg = anon->an_page;
-               mutex_enter(&uvm_pageqlock);
-               uvm_pageactivate(pg);
-               mutex_exit(&uvm_pageqlock);
-               pg->flags &= ~(PG_BUSY|PG_FAKE);
-               UVM_PAGE_OWN(pg, NULL);
+       pg = anon->an_page;
+       mutex_enter(&uvm_pageqlock);
+       uvm_pageactivate(pg);
+       mutex_exit(&uvm_pageqlock);
+       pg->flags &= ~(PG_BUSY|PG_FAKE);
+       UVM_PAGE_OWN(pg, NULL);
 
-               /* deref: can not drop to zero here by defn! */
-               oanon->an_ref--;
+       /* deref: can not drop to zero here by defn! */
+       oanon->an_ref--;
 
-               /*
-                * note: oanon is still locked, as is the new anon.  we
-                * need to check for this later when we unlock oanon; if
-                * oanon != anon, we'll have to unlock anon, too.
-                */
+       /*
+        * note: oanon is still locked, as is the new anon.  we
+        * need to check for this later when we unlock oanon; if
+        * oanon != anon, we'll have to unlock anon, too.
+        */
 
-               return uvm_fault_upper_enter(ufi, flt, uobj, anon, pg, oanon);
+       return uvm_fault_upper_enter(ufi, flt, uobj, anon, pg, oanon);
 }
 
 static int
@@ -1587,15 +1586,15 @@
        struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
        struct uvm_object *uobj, struct vm_anon *anon)
 {
-               struct vm_anon * const oanon = anon;
-               struct vm_page *pg;
+       struct vm_anon * const oanon = anon;
+       struct vm_page *pg;
 
-               uvmexp.flt_anon++;
-               pg = anon->an_page;
-               if (anon->an_ref > 1)     /* disallow writes to ref > 1 anons */
-                       flt->enter_prot = flt->enter_prot & ~VM_PROT_WRITE;
+       uvmexp.flt_anon++;
+       pg = anon->an_page;
+       if (anon->an_ref > 1)     /* disallow writes to ref > 1 anons */
+               flt->enter_prot = flt->enter_prot & ~VM_PROT_WRITE;
 
-               return uvm_fault_upper_enter(ufi, flt, uobj, anon, pg, oanon);
+       return uvm_fault_upper_enter(ufi, flt, uobj, anon, pg, oanon);
 }
 
 static int
@@ -1780,118 +1779,118 @@
        struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
        struct vm_page **ruobjpage)
 {
-               struct vm_amap * const amap = ufi->entry->aref.ar_amap;
-               struct uvm_object * const uobj = ufi->entry->object.uvm_obj;
-               struct vm_page *uobjpage;
-               bool locked;
-               int gotpages;
-               int error;
-               voff_t uoff;
-
-               /* update rusage counters */
-               curlwp->l_ru.ru_majflt++;
-
-               /* locked: maps(read), amap(if there), uobj */
-               uvmfault_unlockall(ufi, amap, NULL, NULL);
-               /* locked: uobj */
-
-               uvmexp.fltget++;
-               gotpages = 1;
-               uoff = (ufi->orig_rvaddr - ufi->entry->start) + ufi->entry->offset;
-               error = uobj->pgops->pgo_get(uobj, uoff, &uobjpage, &gotpages,



Home | Main Index | Thread Index | Old Index