Skip to content

Commit 968614f

Browse files
xzpetertorvalds
authored andcommitted
mm/x86: use general page fault accounting
Use the general page fault accounting by passing regs into handle_mm_fault(). Signed-off-by: Peter Xu <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: H. Peter Anvin <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent f08147d commit 968614f

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

arch/x86/mm/fault.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ void do_user_addr_fault(struct pt_regs *regs,
11391139
struct vm_area_struct *vma;
11401140
struct task_struct *tsk;
11411141
struct mm_struct *mm;
1142-
vm_fault_t fault, major = 0;
1142+
vm_fault_t fault;
11431143
unsigned int flags = FAULT_FLAG_DEFAULT;
11441144

11451145
tsk = current;
@@ -1291,8 +1291,7 @@ void do_user_addr_fault(struct pt_regs *regs,
12911291
* userland). The return to userland is identified whenever
12921292
* FAULT_FLAG_USER|FAULT_FLAG_KILLABLE are both set in flags.
12931293
*/
1294-
fault = handle_mm_fault(vma, address, flags, NULL);
1295-
major |= fault & VM_FAULT_MAJOR;
1294+
fault = handle_mm_fault(vma, address, flags, regs);
12961295

12971296
/* Quick path to respond to signals */
12981297
if (fault_signal_pending(fault, regs)) {
@@ -1319,18 +1318,6 @@ void do_user_addr_fault(struct pt_regs *regs,
13191318
return;
13201319
}
13211320

1322-
/*
1323-
* Major/minor page fault accounting. If any of the events
1324-
* returned VM_FAULT_MAJOR, we account it as a major fault.
1325-
*/
1326-
if (major) {
1327-
tsk->maj_flt++;
1328-
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address);
1329-
} else {
1330-
tsk->min_flt++;
1331-
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address);
1332-
}
1333-
13341321
check_v8086_mode(regs, address, tsk);
13351322
}
13361323
NOKPROBE_SYMBOL(do_user_addr_fault);

0 commit comments

Comments
 (0)