Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Rewrite uvm_fault() loop using while () than goto.



details:   https://anonhg.NetBSD.org/src/rev/f4d0686e2b4e
branches:  trunk
changeset: 751343:f4d0686e2b4e
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Mon Feb 01 08:19:17 2010 +0000

description:
Rewrite uvm_fault() loop using while () than goto.

diffstat:

 sys/uvm/uvm_fault.c |  24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diffs (59 lines):

diff -r 20f75ea774cb -r f4d0686e2b4e sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Mon Feb 01 08:16:32 2010 +0000
+++ b/sys/uvm/uvm_fault.c       Mon Feb 01 08:19:17 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.141 2010/02/01 08:16:32 uebayasi Exp $ */
+/*     $NetBSD: uvm_fault.c,v 1.142 2010/02/01 08:19:17 uebayasi Exp $ */
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.141 2010/02/01 08:16:32 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.142 2010/02/01 08:19:17 uebayasi Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -760,32 +760,28 @@
        /*
         * "goto ReFault" means restart the page fault from ground zero.
         */
-ReFault:
+
+       error = ERESTART;
+       while (error == ERESTART) {
 
        anons = anons_store;
        pages = pages_store;
 
        error = uvm_fault_check(&ufi, &flt, &anons, &pages);
-       if (error == ERESTART)
-               goto ReFault;
-       else if (error)
-               goto done;
+       if (error != 0)
+               continue;
 
        error = uvm_fault_upper_lookup(&ufi, &flt, anons, pages);
-       if (error == ERESTART)
-               goto ReFault;
-       else if (error)
-               goto done;
+       if (error != 0)
+               continue;
 
        if (flt.shadowed == true)
                error = uvm_fault_upper(&ufi, &flt, anons, pages);
        else
                error = uvm_fault_lower(&ufi, &flt, anons, pages);
 
-       if (error == ERESTART)
-               goto ReFault;
+       }
 
-done:
        if (flt.anon_spare != NULL) {
                flt.anon_spare->an_ref--;
                uvm_anfree(flt.anon_spare);



Home | Main Index | Thread Index | Old Index