Skip to content

Commit 484e51e

Browse files
xzpetertorvalds
authored andcommitted
mm/xtensa: 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. Remove the PERF_COUNT_SW_PAGE_FAULTS_[MAJ|MIN] perf events because it's now also done in handle_mm_fault(). Move the PERF_COUNT_SW_PAGE_FAULTS event higher before taking mmap_sem for the fault, then it'll match with the rest of the archs. Signed-off-by: Peter Xu <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Max Filippov <[email protected]> Cc: Chris Zankel <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 968614f commit 484e51e

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

arch/xtensa/mm/fault.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ void do_page_fault(struct pt_regs *regs)
7272

7373
if (user_mode(regs))
7474
flags |= FAULT_FLAG_USER;
75+
76+
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
77+
7578
retry:
7679
mmap_read_lock(mm);
7780
vma = find_vma(mm, address);
@@ -107,7 +110,7 @@ void do_page_fault(struct pt_regs *regs)
107110
* make sure we exit gracefully rather than endlessly redo
108111
* the fault.
109112
*/
110-
fault = handle_mm_fault(vma, address, flags, NULL);
113+
fault = handle_mm_fault(vma, address, flags, regs);
111114

112115
if (fault_signal_pending(fault, regs))
113116
return;
@@ -122,10 +125,6 @@ void do_page_fault(struct pt_regs *regs)
122125
BUG();
123126
}
124127
if (flags & FAULT_FLAG_ALLOW_RETRY) {
125-
if (fault & VM_FAULT_MAJOR)
126-
current->maj_flt++;
127-
else
128-
current->min_flt++;
129128
if (fault & VM_FAULT_RETRY) {
130129
flags |= FAULT_FLAG_TRIED;
131130

@@ -139,12 +138,6 @@ void do_page_fault(struct pt_regs *regs)
139138
}
140139

141140
mmap_read_unlock(mm);
142-
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
143-
if (flags & VM_FAULT_MAJOR)
144-
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address);
145-
else
146-
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address);
147-
148141
return;
149142

150143
/* Something tried to access memory that isn't in our memory map..

0 commit comments

Comments
 (0)