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

CC: Dave Hansen <dave.han...@linux.intel.com>
CC: Andy Lutomirski <l...@kernel.org>
CC: Peter Zijlstra <pet...@infradead.org>
CC: Thomas Gleixner <t...@linutronix.de>
CC: Ingo Molnar <mi...@redhat.com>
CC: Borislav Petkov <b...@alien8.de>
CC: x...@kernel.org
CC: H. Peter Anvin <h...@zytor.com>
Signed-off-by: Peter Xu <pet...@redhat.com>
---
 arch/x86/mm/fault.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index a51df516b87b..28635b4e324c 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1365,8 +1365,6 @@ void do_user_addr_fault(struct pt_regs *regs,
                        local_irq_enable();
        }
 
-       perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
-
        if (hw_error_code & X86_PF_WRITE)
                flags |= FAULT_FLAG_WRITE;
        if (hw_error_code & X86_PF_INSTR)
@@ -1493,13 +1491,7 @@ void do_user_addr_fault(struct pt_regs *regs,
         * Major/minor page fault accounting. If any of the events
         * returned VM_FAULT_MAJOR, we account it as a major fault.
         */
-       if (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);
-       }
+       mm_fault_accounting(tsk, regs, address, major);
 
        check_v8086_mode(regs, address, tsk);
 }
-- 
2.26.2

Reply via email to