[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200615222328.8745-1-peterx@redhat.com>
Date: Mon, 15 Jun 2020 18:23:28 -0400
From: Peter Xu <peterx@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: Peter Xu <peterx@...hat.com>,
Gerald Schaefer <gerald.schaefer@...ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Chris Zankel <chris@...kel.net>,
Max Filippov <jcmvbkbc@...il.com>,
linux-xtensa@...ux-xtensa.org
Subject: [PATCH 25/25] mm/xtensa: Use mm_fault_accounting()
Use the new mm_fault_accounting() helper for page fault accounting.
Avoid doing page fault accounting multiple times if the page fault is retried.
CC: Chris Zankel <chris@...kel.net>
CC: Max Filippov <jcmvbkbc@...il.com>
CC: linux-xtensa@...ux-xtensa.org
Signed-off-by: Peter Xu <peterx@...hat.com>
---
arch/xtensa/mm/fault.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c
index e7172bd53ced..511a2c5f9857 100644
--- a/arch/xtensa/mm/fault.c
+++ b/arch/xtensa/mm/fault.c
@@ -42,7 +42,7 @@ void do_page_fault(struct pt_regs *regs)
int code;
int is_write, is_exec;
- vm_fault_t fault;
+ vm_fault_t fault, major = 0;
unsigned int flags = FAULT_FLAG_DEFAULT;
code = SEGV_MAPERR;
@@ -109,6 +109,7 @@ void do_page_fault(struct pt_regs *regs)
* the fault.
*/
fault = handle_mm_fault(vma, address, flags);
+ major |= fault & VM_FAULT_MAJOR;
if (fault_signal_pending(fault, regs))
return;
@@ -123,10 +124,6 @@ void do_page_fault(struct pt_regs *regs)
BUG();
}
if (flags & FAULT_FLAG_ALLOW_RETRY) {
- if (fault & VM_FAULT_MAJOR)
- current->maj_flt++;
- else
- current->min_flt++;
if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED;
@@ -140,12 +137,7 @@ void do_page_fault(struct pt_regs *regs)
}
up_read(&mm->mmap_sem);
- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
- if (flags & VM_FAULT_MAJOR)
- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address);
- else
- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address);
-
+ mm_fault_accounting(current, regs, address, major);
return;
/* Something tried to access memory that isn't in our memory map..
--
2.26.2
Powered by blists - more mailing lists