Merge tag 'riscv-for-linus-5.9-mw1' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / arch / arc / mm / fault.c
index 92b339c..f5657cb 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/kdebug.h>
 #include <linux/perf_event.h>
 #include <linux/mm_types.h>
-#include <asm/pgalloc.h>
 #include <asm/mmu.h>
 
 /*
@@ -106,8 +105,9 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
        if (write)
                flags |= FAULT_FLAG_WRITE;
 
+       perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
 retry:
-       down_read(&mm->mmap_sem);
+       mmap_read_lock(mm);
 
        vma = find_vma(mm, address);
        if (!vma)
@@ -131,7 +131,7 @@ retry:
                goto bad_area;
        }
 
-       fault = handle_mm_fault(vma, address, flags);
+       fault = handle_mm_fault(vma, address, flags, regs);
 
        /* Quick path to respond to signals */
        if (fault_signal_pending(fault, regs)) {
@@ -141,7 +141,7 @@ retry:
        }
 
        /*
-        * Fault retry nuances, mmap_sem already relinquished by core mm
+        * Fault retry nuances, mmap_lock already relinquished by core mm
         */
        if (unlikely((fault & VM_FAULT_RETRY) &&
                     (flags & FAULT_FLAG_ALLOW_RETRY))) {
@@ -150,28 +150,15 @@ retry:
        }
 
 bad_area:
-       up_read(&mm->mmap_sem);
+       mmap_read_unlock(mm);
 
        /*
         * Major/minor page fault accounting
         * (in case of retry we only land here once)
         */
-       perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
-
-       if (likely(!(fault & VM_FAULT_ERROR))) {
-               if (fault & VM_FAULT_MAJOR) {
-                       tsk->maj_flt++;
-                       perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
-                                     regs, address);
-               } else {
-                       tsk->min_flt++;
-                       perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
-                                     regs, address);
-               }
-
+       if (likely(!(fault & VM_FAULT_ERROR)))
                /* Normal return path: fault Handled Gracefully */
                return;
-       }
 
        if (!user_mode(regs))
                goto no_context;