Skip to content

Commit e1c17f6

Browse files
xzpetertorvalds
authored andcommitted
mm/m68k: 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]> Cc: Geert Uytterhoeven <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent b444eed commit e1c17f6

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

arch/m68k/mm/fault.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/interrupt.h>
1313
#include <linux/module.h>
1414
#include <linux/uaccess.h>
15+
#include <linux/perf_event.h>
1516

1617
#include <asm/setup.h>
1718
#include <asm/traps.h>
@@ -84,6 +85,8 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
8485

8586
if (user_mode(regs))
8687
flags |= FAULT_FLAG_USER;
88+
89+
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
8790
retry:
8891
mmap_read_lock(mm);
8992

@@ -134,7 +137,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
134137
* the fault.
135138
*/
136139

137-
fault = handle_mm_fault(vma, address, flags, NULL);
140+
fault = handle_mm_fault(vma, address, flags, regs);
138141
pr_debug("handle_mm_fault returns %x\n", fault);
139142

140143
if (fault_signal_pending(fault, regs))
@@ -150,16 +153,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
150153
BUG();
151154
}
152155

153-
/*
154-
* Major/minor page fault accounting is only done on the
155-
* initial attempt. If we go through a retry, it is extremely
156-
* likely that the page will be found in page cache at that point.
157-
*/
158156
if (flags & FAULT_FLAG_ALLOW_RETRY) {
159-
if (fault & VM_FAULT_MAJOR)
160-
current->maj_flt++;
161-
else
162-
current->min_flt++;
163157
if (fault & VM_FAULT_RETRY) {
164158
flags |= FAULT_FLAG_TRIED;
165159

0 commit comments

Comments
 (0)