History

mm/nios2: 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 4487dcf1 parent daf7bf51 file · +4 −10Browse files

Unified · Split

arch/nios2/mm/fault.c+4−10
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include <linux/mm.h>
2525 #include <linux/extable.h>
2626 #include <linux/uaccess.h>
27+#include <linux/perf_event.h>
2728
2829 #include <asm/mmu_context.h>
2930 #include <asm/traps.h>
@@ -83,6 +84,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause, · 53 unmodified lines
8384 if (user_mode(regs))
8485 flags |= FAULT_FLAG_USER;
8586
87+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
88+
8689 if (!mmap_read_trylock(mm)) {
8790 if (!user_mode(regs) && !search_exception_tables(regs->ea))
8891 goto bad_area_nosemaphore;
@@ -131,7 +134,7 @@ good_area: · 42 unmodified lines
131134 * make sure we exit gracefully rather than endlessly redo
132135 * the fault.
133136 */
134− fault = handle_mm_fault(vma, address, flags, NULL);
137+ fault = handle_mm_fault(vma, address, flags, regs);
135138
136139 if (fault_signal_pending(fault, regs))
137140 return;
@@ -146,16 +149,7 @@ good_area: · 8 unmodified lines
146149 BUG();
147150 }
148151
149− /*
150− * Major/minor page fault accounting is only done on the
151− * initial attempt. If we go through a retry, it is extremely
152− * likely that the page will be found in page cache at that point.
153− */
154152 if (flags & FAULT_FLAG_ALLOW_RETRY) {
155− if (fault & VM_FAULT_MAJOR)
156− current->maj_flt++;
157− else
158− current->min_flt++;
159153 if (fault & VM_FAULT_RETRY) {
160154 flags |= FAULT_FLAG_TRIED;
161155

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