mm: fault feedback #2
[linux-2.6.git] / arch / xtensa / mm / fault.c
index dd0dbec2e57e4f39b51ab7a73359a0117e638b48..16004067add3650db60f398005007e8dd97be3b9 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/system.h>
 #include <asm/pgalloc.h>
 
-unsigned long asid_cache = ASID_FIRST_VERSION;
+unsigned long asid_cache = ASID_USER_FIRST;
 void bad_page_fault(struct pt_regs*, unsigned long, int);
 
 /*
@@ -41,6 +41,7 @@ void do_page_fault(struct pt_regs *regs)
        siginfo_t info;
 
        int is_write, is_exec;
+       int fault;
 
        info.si_code = SEGV_MAPERR;
 
@@ -58,10 +59,10 @@ void do_page_fault(struct pt_regs *regs)
                return;
        }
 
-       is_write = (exccause == XCHAL_EXCCAUSE_STORE_CACHE_ATTRIBUTE) ? 1 : 0;
-       is_exec =  (exccause == XCHAL_EXCCAUSE_ITLB_PRIVILEGE ||
-                   exccause == XCHAL_EXCCAUSE_ITLB_MISS ||
-                   exccause == XCHAL_EXCCAUSE_FETCH_CACHE_ATTRIBUTE) ? 1 : 0;
+       is_write = (exccause == EXCCAUSE_STORE_CACHE_ATTRIBUTE) ? 1 : 0;
+       is_exec =  (exccause == EXCCAUSE_ITLB_PRIVILEGE ||
+                   exccause == EXCCAUSE_ITLB_MISS ||
+                   exccause == EXCCAUSE_FETCH_CACHE_ATTRIBUTE) ? 1 : 0;
 
 #if 0
        printk("[%s:%d:%08x:%d:%08x:%s%s]\n", current->comm, current->pid,
@@ -102,20 +103,18 @@ good_area:
         * the fault.
         */
 survive:
-       switch (handle_mm_fault(mm, vma, address, is_write)) {
-       case VM_FAULT_MINOR:
-               current->min_flt++;
-               break;
-       case VM_FAULT_MAJOR:
-               current->maj_flt++;
-               break;
-       case VM_FAULT_SIGBUS:
-               goto do_sigbus;
-       case VM_FAULT_OOM:
-               goto out_of_memory;
-       default:
+       fault = handle_mm_fault(mm, vma, address, is_write);
+       if (unlikely(fault & VM_FAULT_ERROR)) {
+               if (fault & VM_FAULT_OOM)
+                       goto out_of_memory;
+               else if (fault & VM_FAULT_SIGBUS)
+                       goto do_sigbus;
                BUG();
        }
+       if (fault & VM_FAULT_MAJOR)
+               current->maj_flt++;
+       else
+               current->min_flt++;
 
        up_read(&mm->mmap_sem);
        return;