Skip to content

Commit 52e3f8d

Browse files
xzpetertorvalds
authored andcommitted
mm/arc: 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. Fix PERF_COUNT_SW_PAGE_FAULTS perf event manually for page fault retries, by moving it before taking mmap_sem. Signed-off-by: Peter Xu <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Vineet Gupta <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent c0f6eda commit 52e3f8d

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

arch/arc/mm/fault.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
105105
if (write)
106106
flags |= FAULT_FLAG_WRITE;
107107

108+
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
108109
retry:
109110
mmap_read_lock(mm);
110111

@@ -130,7 +131,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
130131
goto bad_area;
131132
}
132133

133-
fault = handle_mm_fault(vma, address, flags, NULL);
134+
fault = handle_mm_fault(vma, address, flags, regs);
134135

135136
/* Quick path to respond to signals */
136137
if (fault_signal_pending(fault, regs)) {
@@ -155,22 +156,9 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
155156
* Major/minor page fault accounting
156157
* (in case of retry we only land here once)
157158
*/
158-
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
159-
160-
if (likely(!(fault & VM_FAULT_ERROR))) {
161-
if (fault & VM_FAULT_MAJOR) {
162-
tsk->maj_flt++;
163-
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
164-
regs, address);
165-
} else {
166-
tsk->min_flt++;
167-
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
168-
regs, address);
169-
}
170-
159+
if (likely(!(fault & VM_FAULT_ERROR)))
171160
/* Normal return path: fault Handled Gracefully */
172161
return;
173-
}
174162

175163
if (!user_mode(regs))
176164
goto no_context;

0 commit comments

Comments
 (0)