xtensa: count software page fault perf events
authorMax Filippov <jcmvbkbc@gmail.com>
Thu, 4 Jun 2015 10:42:22 +0000 (13:42 +0300)
committerMax Filippov <jcmvbkbc@gmail.com>
Mon, 17 Aug 2015 04:33:26 +0000 (07:33 +0300)
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
arch/xtensa/mm/fault.c

index 83a44a33cfa11221f99ba5f8d836e02a0c4c9f92..c9784c1b18d8c6223afe359e4e4405b430b91780 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/hardirq.h>
+#include <linux/perf_event.h>
 #include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>
@@ -142,6 +143,12 @@ good_area:
        }
 
        up_read(&mm->mmap_sem);
+       perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
+       if (flags & VM_FAULT_MAJOR)
+               perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address);
+       else if (flags & VM_FAULT_MINOR)
+               perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address);
+
        return;
 
        /* Something tried to access memory that isn't in our memory map..