Skip to content

Commit 5ac365a

Browse files
xzpetertorvalds
authored andcommitted
mm/riscv: 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. Signed-off-by: Peter Xu <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Pekka Enberg <[email protected]> Acked-by: Palmer Dabbelt <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Albert Ou <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 428fdc0 commit 5ac365a

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

arch/riscv/mm/fault.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
109109
* make sure we exit gracefully rather than endlessly redo
110110
* the fault.
111111
*/
112-
fault = handle_mm_fault(vma, addr, flags, NULL);
112+
fault = handle_mm_fault(vma, addr, flags, regs);
113113

114114
/*
115115
* If we need to retry but a fatal signal is pending, handle the
@@ -127,21 +127,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
127127
BUG();
128128
}
129129

130-
/*
131-
* Major/minor page fault accounting is only done on the
132-
* initial attempt. If we go through a retry, it is extremely
133-
* likely that the page will be found in page cache at that point.
134-
*/
135130
if (flags & FAULT_FLAG_ALLOW_RETRY) {
136-
if (fault & VM_FAULT_MAJOR) {
137-
tsk->maj_flt++;
138-
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ,
139-
1, regs, addr);
140-
} else {
141-
tsk->min_flt++;
142-
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN,
143-
1, regs, addr);
144-
}
145131
if (fault & VM_FAULT_RETRY) {
146132
flags |= FAULT_FLAG_TRIED;
147133

0 commit comments

Comments
 (0)