diff options
| -rw-r--r-- | arch/sparc/mm/fault_32.c | 12 | ||||
| -rw-r--r-- | arch/sparc/mm/fault_64.c | 13 |
2 files changed, 20 insertions, 5 deletions
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c index b99f81c4906..a3413acb8f1 100644 --- a/arch/sparc/mm/fault_32.c +++ b/arch/sparc/mm/fault_32.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/signal.h> | 18 | #include <linux/signal.h> |
| 19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
| 20 | #include <linux/smp.h> | 20 | #include <linux/smp.h> |
| 21 | #include <linux/perf_event.h> | ||
| 21 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
| 22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| 23 | #include <linux/kdebug.h> | 24 | #include <linux/kdebug.h> |
| @@ -203,6 +204,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, | |||
| 203 | if (in_atomic() || !mm) | 204 | if (in_atomic() || !mm) |
| 204 | goto no_context; | 205 | goto no_context; |
| 205 | 206 | ||
| 207 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); | ||
| 208 | |||
| 206 | down_read(&mm->mmap_sem); | 209 | down_read(&mm->mmap_sem); |
| 207 | 210 | ||
| 208 | /* | 211 | /* |
| @@ -249,10 +252,15 @@ good_area: | |||
| 249 | goto do_sigbus; | 252 | goto do_sigbus; |
| 250 | BUG(); | 253 | BUG(); |
| 251 | } | 254 | } |
| 252 | if (fault & VM_FAULT_MAJOR) | 255 | if (fault & VM_FAULT_MAJOR) { |
| 253 | current->maj_flt++; | 256 | current->maj_flt++; |
| 254 | else | 257 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, |
| 258 | regs, address); | ||
| 259 | } else { | ||
| 255 | current->min_flt++; | 260 | current->min_flt++; |
| 261 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, | ||
| 262 | regs, address); | ||
| 263 | } | ||
| 256 | up_read(&mm->mmap_sem); | 264 | up_read(&mm->mmap_sem); |
| 257 | return; | 265 | return; |
| 258 | 266 | ||
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c index 6081936bf03..b9d4ff02b8f 100644 --- a/arch/sparc/mm/fault_64.c +++ b/arch/sparc/mm/fault_64.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
| 19 | #include <linux/perf_event.h> | ||
| 19 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
| 20 | #include <linux/kprobes.h> | 21 | #include <linux/kprobes.h> |
| 21 | #include <linux/kdebug.h> | 22 | #include <linux/kdebug.h> |
| @@ -296,6 +297,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) | |||
| 296 | if (in_atomic() || !mm) | 297 | if (in_atomic() || !mm) |
| 297 | goto intr_or_no_mm; | 298 | goto intr_or_no_mm; |
| 298 | 299 | ||
| 300 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); | ||
| 301 | |||
| 299 | if (!down_read_trylock(&mm->mmap_sem)) { | 302 | if (!down_read_trylock(&mm->mmap_sem)) { |
| 300 | if ((regs->tstate & TSTATE_PRIV) && | 303 | if ((regs->tstate & TSTATE_PRIV) && |
| 301 | !search_exception_tables(regs->tpc)) { | 304 | !search_exception_tables(regs->tpc)) { |
| @@ -400,11 +403,15 @@ good_area: | |||
| 400 | goto do_sigbus; | 403 | goto do_sigbus; |
| 401 | BUG(); | 404 | BUG(); |
| 402 | } | 405 | } |
| 403 | if (fault & VM_FAULT_MAJOR) | 406 | if (fault & VM_FAULT_MAJOR) { |
| 404 | current->maj_flt++; | 407 | current->maj_flt++; |
| 405 | else | 408 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, |
| 409 | regs, address); | ||
| 410 | } else { | ||
| 406 | current->min_flt++; | 411 | current->min_flt++; |
| 407 | 412 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, | |
| 413 | regs, address); | ||
| 414 | } | ||
| 408 | up_read(&mm->mmap_sem); | 415 | up_read(&mm->mmap_sem); |
| 409 | 416 | ||
| 410 | mm_rss = get_mm_rss(mm); | 417 | mm_rss = get_mm_rss(mm); |
