diff options
author | Mao Han <han_mao@c-sky.com> | 2019-04-18 09:20:40 +0300 |
---|---|---|
committer | Guo Ren <ren_guo@c-sky.com> | 2019-04-22 08:44:57 +0300 |
commit | 0eaf50deec8d550164b3cf6a5d68ec1072916f0e (patch) | |
tree | ed94bdd19db1664ef8c88cffe746e963dff7e545 /arch/csky | |
parent | 683fafebf93bcde9948246849348b888e185cb22 (diff) | |
download | linux-0eaf50deec8d550164b3cf6a5d68ec1072916f0e.tar.xz |
csky: add page fault perf event support
This patch add support for page fault count, major fault count
and minorfault count. Without this patch page faults are not
sampled for perf event.
Performance counter stats for '/usr/lib/perf-test/callchain_test':
0 page-faults # 0.000 K/sec
Signed-off-by: Mao Han <han_mao@c-sky.com>
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Diffstat (limited to 'arch/csky')
-rw-r--r-- | arch/csky/mm/fault.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c index 5beb25ca1c79..aeb9a5f11e00 100644 --- a/arch/csky/mm/fault.c +++ b/arch/csky/mm/fault.c @@ -17,6 +17,7 @@ #include <linux/vt_kern.h> #include <linux/extable.h> #include <linux/uaccess.h> +#include <linux/perf_event.h> #include <asm/hardirq.h> #include <asm/mmu_context.h> @@ -106,6 +107,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, return; } #endif + + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); /* * If we're in an interrupt or have no user * context, we must not take the fault.. @@ -153,10 +156,15 @@ good_area: goto bad_area; BUG(); } - if (fault & VM_FAULT_MAJOR) + if (fault & VM_FAULT_MAJOR) { tsk->maj_flt++; - else + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, + address); + } else { tsk->min_flt++; + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, + address); + } up_read(&mm->mmap_sem); return; |