Skip to content

Commit 38caa90

Browse files
xzpetertorvalds
authored andcommitted
mm/openrisc: 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: Stafford Horne <[email protected]> Cc: Jonas Bonn <[email protected]> Cc: Stefan Kristiansson <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 4487dcf commit 38caa90

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

arch/openrisc/mm/fault.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/interrupt.h>
1616
#include <linux/extable.h>
1717
#include <linux/sched/signal.h>
18+
#include <linux/perf_event.h>
1819

1920
#include <linux/uaccess.h>
2021
#include <asm/siginfo.h>
@@ -103,6 +104,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address,
103104
if (in_interrupt() || !mm)
104105
goto no_context;
105106

107+
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
108+
106109
retry:
107110
mmap_read_lock(mm);
108111
vma = find_vma(mm, address);
@@ -159,7 +162,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address,
159162
* the fault.
160163
*/
161164

162-
fault = handle_mm_fault(vma, address, flags, NULL);
165+
fault = handle_mm_fault(vma, address, flags, regs);
163166

164167
if (fault_signal_pending(fault, regs))
165168
return;
@@ -176,10 +179,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address,
176179

177180
if (flags & FAULT_FLAG_ALLOW_RETRY) {
178181
/*RGD modeled on Cris */
179-
if (fault & VM_FAULT_MAJOR)
180-
tsk->maj_flt++;
181-
else
182-
tsk->min_flt++;
183182
if (fault & VM_FAULT_RETRY) {
184183
flags |= FAULT_FLAG_TRIED;
185184

0 commit comments

Comments
 (0)