Use the new mm_fault_accounting() helper for page fault accounting.

The functional change here is that now we take the whole page fault as a major
fault as long as any of the retried page fault is a major fault.  Previously we
only considered the last fault.

CC: Vineet Gupta <vgu...@synopsys.com>
CC: linux-snps-arc@lists.infradead.org
Signed-off-by: Peter Xu <pet...@redhat.com>
---
 arch/arc/mm/fault.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c
index 92b339c7adba..bc89d4b9c59d 100644
--- a/arch/arc/mm/fault.c
+++ b/arch/arc/mm/fault.c
@@ -72,6 +72,7 @@ void do_page_fault(unsigned long address, struct pt_regs 
*regs)
        int sig, si_code = SEGV_MAPERR;
        unsigned int write = 0, exec = 0, mask;
        vm_fault_t fault = VM_FAULT_SIGSEGV;    /* handle_mm_fault() output */
+       vm_fault_t major = 0;
        unsigned int flags;                     /* handle_mm_fault() input */
 
        /*
@@ -132,6 +133,7 @@ void do_page_fault(unsigned long address, struct pt_regs 
*regs)
        }
 
        fault = handle_mm_fault(vma, address, flags);
+       major |= fault & VM_FAULT_MAJOR;
 
        /* Quick path to respond to signals */
        if (fault_signal_pending(fault, regs)) {
@@ -156,20 +158,9 @@ void do_page_fault(unsigned long address, struct pt_regs 
*regs)
         * 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);
-               }
-
                /* Normal return path: fault Handled Gracefully */
+               mm_fault_accounting(tsk, regs, address, major);
                return;
        }
 
-- 
2.26.2


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Reply via email to