#include <linux/kdebug.h>
 #include <linux/prefetch.h>
 #include <linux/uaccess.h>
+#include <linux/perf_event.h>
 
 #include <asm/processor.h>
 #include <asm/exception.h>
                flags |= FAULT_FLAG_USER;
        if (mask & VM_WRITE)
                flags |= FAULT_FLAG_WRITE;
+
+       perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
 retry:
        mmap_read_lock(mm);
 
         * sure we exit gracefully rather than endlessly redo the
         * fault.
         */
-       fault = handle_mm_fault(vma, address, flags, NULL);
+       fault = handle_mm_fault(vma, address, flags, regs);
 
        if (fault_signal_pending(fault, regs))
                return;
        }
 
        if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_MAJOR)
-                       current->maj_flt++;
-               else
-                       current->min_flt++;
                if (fault & VM_FAULT_RETRY) {
                        flags |= FAULT_FLAG_TRIED;