Skip to content

Commit e08157c

Browse files
xzpetertorvalds
authored andcommitted
mm/hexagon: 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]> Acked-by: Brian Cain <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent a2a9e43 commit e08157c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

arch/hexagon/mm/vm_fault.c

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

2223
/*
2324
* Decode of hardware exception sends us to one of several
@@ -53,6 +54,8 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
5354

5455
if (user_mode(regs))
5556
flags |= FAULT_FLAG_USER;
57+
58+
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
5659
retry:
5760
mmap_read_lock(mm);
5861
vma = find_vma(mm, address);
@@ -88,18 +91,14 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
8891
break;
8992
}
9093

91-
fault = handle_mm_fault(vma, address, flags, NULL);
94+
fault = handle_mm_fault(vma, address, flags, regs);
9295

9396
if (fault_signal_pending(fault, regs))
9497
return;
9598

9699
/* The most common case -- we are done. */
97100
if (likely(!(fault & VM_FAULT_ERROR))) {
98101
if (flags & FAULT_FLAG_ALLOW_RETRY) {
99-
if (fault & VM_FAULT_MAJOR)
100-
current->maj_flt++;
101-
else
102-
current->min_flt++;
103102
if (fault & VM_FAULT_RETRY) {
104103
flags |= FAULT_FLAG_TRIED;
105104
goto retry;

0 commit comments

Comments
 (0)