aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm
diff options
context:
space:
mode:
authorDeng-Cheng Zhu <dengcheng.zhu@gmail.com>2010-10-12 07:37:21 -0400
committerRalf Baechle <ralf@linux-mips.org>2010-10-29 14:08:48 -0400
commit7f788d2d53085815d474559cd51ef1f38b0a9bb8 (patch)
tree32c2b6af15da818a02502a678225ff4de754b542 /arch/mips/mm
parent6dbd972850c092e50e10bd14a3324e2abe88997a (diff)
MIPS: add support for software performance events
Software events are required as part of the measurable stuff by the Linux performance counter subsystem. Here is the list of events added by this patch: PERF_COUNT_SW_PAGE_FAULTS PERF_COUNT_SW_PAGE_FAULTS_MIN PERF_COUNT_SW_PAGE_FAULTS_MAJ PERF_COUNT_SW_ALIGNMENT_FAULTS PERF_COUNT_SW_EMULATION_FAULTS Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@gmail.com> To: linux-mips@linux-mips.org Cc: a.p.zijlstra@chello.nl Cc: paulus@samba.org Cc: mingo@elte.hu Cc: acme@redhat.com Cc: jamie.iles@picochip.com Acked-by: David Daney <ddaney@caviumnetworks.com> Reviewed-by: Matt Fleming <matt@console-pimps.org> Patchwork: https://patchwork.linux-mips.org/patch/1686/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/mm')
-rw-r--r--arch/mips/mm/fault.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 783ad0065fdf..137ee76a0045 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -18,6 +18,7 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/kprobes.h> 20#include <linux/kprobes.h>
21#include <linux/perf_event.h>
21 22
22#include <asm/branch.h> 23#include <asm/branch.h>
23#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
@@ -144,6 +145,7 @@ good_area:
144 * the fault. 145 * the fault.
145 */ 146 */
146 fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 147 fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0);
148 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
147 if (unlikely(fault & VM_FAULT_ERROR)) { 149 if (unlikely(fault & VM_FAULT_ERROR)) {
148 if (fault & VM_FAULT_OOM) 150 if (fault & VM_FAULT_OOM)
149 goto out_of_memory; 151 goto out_of_memory;
@@ -151,10 +153,15 @@ good_area:
151 goto do_sigbus; 153 goto do_sigbus;
152 BUG(); 154 BUG();
153 } 155 }
154 if (fault & VM_FAULT_MAJOR) 156 if (fault & VM_FAULT_MAJOR) {
157 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ,
158 1, 0, regs, address);
155 tsk->maj_flt++; 159 tsk->maj_flt++;
156 else 160 } else {
161 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN,
162 1, 0, regs, address);
157 tsk->min_flt++; 163 tsk->min_flt++;
164 }
158 165
159 up_read(&mm->mmap_sem); 166 up_read(&mm->mmap_sem);
160 return; 167 return;