History

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().

Peter Xu committed 6 years ago

Commit e1c17f61 parent b444eed1 file · +4 −10Browse files

Unified · Split

arch/m68k/mm/fault.c+4−10
@@ -12,6 +12,7 @@ · 11 unmodified lines
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, · 66 unmodified lines
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 @@ good_area: · 44 unmodified lines
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 @@ good_area: · 9 unmodified lines
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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t