History

mm/nds32: 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. Fix PERF_COUNT_SW_PAGE_FAULTS perf event manually for page fault retries, by moving it before taking mmap_sem.

Peter Xu committed 6 years ago

Commit daf7bf51 parent 2558fd71 file · +3 −16Browse files

Unified · Split

arch/nds32/mm/fault.c+3−16
@@ -121,6 +121,8 @@ void do_page_fault(unsigned long entry, unsigned long addr, · 120 unmodified lines
121121 if (unlikely(faulthandler_disabled() || !mm))
122122 goto no_context;
123123
124+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
125+
124126 /*
125127 * As per x86, we may deadlock here. However, since the kernel only
126128 * validly references user space from well defined areas of the code,
@@ -206,7 +208,7 @@ good_area: · 79 unmodified lines
206208 * the fault.
207209 */
208210
209− fault = handle_mm_fault(vma, addr, flags, NULL);
211+ fault = handle_mm_fault(vma, addr, flags, regs);
210212
211213 /*
212214 * If we need to retry but a fatal signal is pending, handle the
@@ -228,22 +230,7 @@ good_area: · 15 unmodified lines
228230 goto bad_area;
229231 }
230232
231− /*
232− * Major/minor page fault accounting is only done on the initial
233− * attempt. If we go through a retry, it is extremely likely that the
234− * page will be found in page cache at that point.
235− */
236− perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
237233 if (flags & FAULT_FLAG_ALLOW_RETRY) {
238− if (fault & VM_FAULT_MAJOR) {
239− tsk->maj_flt++;
240− perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ,
241− 1, regs, addr);
242− } else {
243− tsk->min_flt++;
244− perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN,
245− 1, regs, addr);
246− }
247234 if (fault & VM_FAULT_RETRY) {
248235 flags |= FAULT_FLAG_TRIED;
249236

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