Module Name:    src
Committed By:   uebayasi
Date:           Mon Feb  1 09:18:41 UTC 2010

Modified Files:
        src/sys/uvm: uvm_fault.c

Log Message:
uvm_fault_upper_lookup: This is totally my personal preference, but can't help
adding one goto to reduce one indent.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/uvm/uvm_fault.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_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.144 src/sys/uvm/uvm_fault.c:1.145
--- src/sys/uvm/uvm_fault.c:1.144	Mon Feb  1 09:06:43 2010
+++ src/sys/uvm/uvm_fault.c	Mon Feb  1 09:18:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.144 2010/02/01 09:06:43 uebayasi Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.145 2010/02/01 09:18:41 uebayasi Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.144 2010/02/01 09:06:43 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.145 2010/02/01 09:18:41 uebayasi Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1045,30 +1045,34 @@
 		}
 		anon = anons[lcv];
 		mutex_enter(&anon->an_lock);
-		/* ignore loaned pages */
-		if (anon->an_page && anon->an_page->loan_count == 0 &&
-		    (anon->an_page->flags & PG_BUSY) == 0) {
-			mutex_enter(&uvm_pageqlock);
-			uvm_pageenqueue(anon->an_page);
-			mutex_exit(&uvm_pageqlock);
-			UVMHIST_LOG(maphist,
-			    "  MAPPING: n anon: pm=0x%x, va=0x%x, pg=0x%x",
-			    ufi->orig_map->pmap, currva, anon->an_page, 0);
-			uvmexp.fltnamap++;
 
-			/*
-			 * Since this isn't the page that's actually faulting,
-			 * ignore pmap_enter() failures; it's not critical
-			 * that we enter these right now.
-			 */
+		/* ignore loaned and busy pages */
+		if (anon->an_page == NULL || anon->an_page->loan_count != 0 ||
+		    (anon->an_page->flags & PG_BUSY) != 0)
+			goto uvm_fault_upper_lookup_enter_done;
 
-			(void) pmap_enter(ufi->orig_map->pmap, currva,
-			    VM_PAGE_TO_PHYS(anon->an_page),
-			    (anon->an_ref > 1) ? (flt->enter_prot & ~VM_PROT_WRITE) :
-			    flt->enter_prot,
-			    PMAP_CANFAIL |
-			     (VM_MAPENT_ISWIRED(ufi->entry) ? PMAP_WIRED : 0));
-		}
+		mutex_enter(&uvm_pageqlock);
+		uvm_pageenqueue(anon->an_page);
+		mutex_exit(&uvm_pageqlock);
+		UVMHIST_LOG(maphist,
+		    "  MAPPING: n anon: pm=0x%x, va=0x%x, pg=0x%x",
+		    ufi->orig_map->pmap, currva, anon->an_page, 0);
+		uvmexp.fltnamap++;
+
+		/*
+		 * Since this isn't the page that's actually faulting,
+		 * ignore pmap_enter() failures; it's not critical
+		 * that we enter these right now.
+		 */
+
+		(void) pmap_enter(ufi->orig_map->pmap, currva,
+		    VM_PAGE_TO_PHYS(anon->an_page),
+		    (anon->an_ref > 1) ? (flt->enter_prot & ~VM_PROT_WRITE) :
+		    flt->enter_prot,
+		    PMAP_CANFAIL |
+		     (VM_MAPENT_ISWIRED(ufi->entry) ? PMAP_WIRED : 0));
+
+uvm_fault_upper_lookup_enter_done:
 		pmap_update(ufi->orig_map->pmap);
 		mutex_exit(&anon->an_lock);
 	}

Reply via email to