Skip to content

Commit aeb6aef

Browse files
xzpetertorvalds
authored andcommitted
mm/microblaze: use general page fault accounting
Use the general page fault accounting by passing regs into handle_mm_fault(). It naturally solve the issue of multiple page fault accounting when page fault retry happened. Add the missing PERF_COUNT_SW_PAGE_FAULTS perf events too. Note, the other two perf events (PERF_COUNT_SW_PAGE_FAULTS_[MAJ|MIN]) were done in handle_mm_fault(). Signed-off-by: Peter Xu <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Michal Simek <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent e1c17f6 commit aeb6aef

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

arch/microblaze/mm/fault.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <linux/mman.h>
2929
#include <linux/mm.h>
3030
#include <linux/interrupt.h>
31+
#include <linux/perf_event.h>
3132

3233
#include <asm/page.h>
3334
#include <asm/mmu.h>
@@ -121,6 +122,8 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
121122
if (user_mode(regs))
122123
flags |= FAULT_FLAG_USER;
123124

125+
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
126+
124127
/* When running in the kernel we expect faults to occur only to
125128
* addresses in user space. All other faults represent errors in the
126129
* kernel and should generate an OOPS. Unfortunately, in the case of an
@@ -214,7 +217,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
214217
* make sure we exit gracefully rather than endlessly redo
215218
* the fault.
216219
*/
217-
fault = handle_mm_fault(vma, address, flags, NULL);
220+
fault = handle_mm_fault(vma, address, flags, regs);
218221

219222
if (fault_signal_pending(fault, regs))
220223
return;
@@ -230,10 +233,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
230233
}
231234

232235
if (flags & FAULT_FLAG_ALLOW_RETRY) {
233-
if (unlikely(fault & VM_FAULT_MAJOR))
234-
current->maj_flt++;
235-
else
236-
current->min_flt++;
237236
if (fault & VM_FAULT_RETRY) {
238237
flags |= FAULT_FLAG_TRIED;
239238

0 commit comments

Comments
 (0)