Skip to content

Commit af8a792

Browse files
xzpetertorvalds
authored andcommitted
mm/parisc: 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: James E.J. Bottomley <[email protected]> Cc: Helge Deller <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 38caa90 commit af8a792

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

arch/parisc/mm/fault.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/extable.h>
1919
#include <linux/uaccess.h>
2020
#include <linux/hugetlb.h>
21+
#include <linux/perf_event.h>
2122

2223
#include <asm/traps.h>
2324

@@ -281,6 +282,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
281282
acc_type = parisc_acctyp(code, regs->iir);
282283
if (acc_type & VM_WRITE)
283284
flags |= FAULT_FLAG_WRITE;
285+
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
284286
retry:
285287
mmap_read_lock(mm);
286288
vma = find_vma_prev(mm, address, &prev_vma);
@@ -302,7 +304,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
302304
* fault.
303305
*/
304306

305-
fault = handle_mm_fault(vma, address, flags, NULL);
307+
fault = handle_mm_fault(vma, address, flags, regs);
306308

307309
if (fault_signal_pending(fault, regs))
308310
return;
@@ -323,10 +325,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
323325
BUG();
324326
}
325327
if (flags & FAULT_FLAG_ALLOW_RETRY) {
326-
if (fault & VM_FAULT_MAJOR)
327-
current->maj_flt++;
328-
else
329-
current->min_flt++;
330328
if (fault & VM_FAULT_RETRY) {
331329
/*
332330
* No need to mmap_read_unlock(mm) as we would

0 commit comments

Comments
 (0)