mm: mm_event: add page fault stat
authorMinchan Kim <minchan@google.com>
Wed, 27 Jun 2018 12:54:47 +0000 (21:54 +0900)
committerPDO SCM Team <hudsoncm@motorola.com>
Fri, 15 Nov 2019 06:58:40 +0000 (00:58 -0600)
This patch add major and minor fault mm_event stat so that we could
keep tracking [avg|max]_latency for the handling the event
as well as count of the event.

With major fault, we could see how long the IO is delayed. It's very
tightly coupled with application's latency.

With major+minor fault, we could see how many of pages are allocated
for the process in the period. It would help to see memory spike.

Mot-CRs-fixed: (CR)

Bug: 80168800
Change-Id: I8a4434493e3ec291227961939a24c3d57a18fd5b
Signed-off-by: Minchan Kim <minchan@google.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
Reviewed-on: https://gerrit.mot.com/1453720
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key

arch/arm64/mm/fault.c

index 692043e0021e102dfa3922e4074822dcfca554c5..6a9520698944b618e6609e33c8118f95df8477d4 100644 (file)
@@ -403,6 +403,9 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
        int fault, sig, code, major = 0;
        unsigned long vm_flags = VM_READ | VM_WRITE;
        unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
+       ktime_t event_ts;
+
+       mm_event_start(&event_ts);
 
        if (notify_page_fault(regs, esr))
                return 0;
@@ -489,6 +492,7 @@ retry:
                        goto retry;
                }
        }
+
        up_read(&mm->mmap_sem);
 
        /*
@@ -506,10 +510,12 @@ retry:
                        tsk->maj_flt++;
                        perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs,
                                      addr);
+                       mm_event_end(MM_MAJ_FAULT, event_ts);
                } else {
                        tsk->min_flt++;
                        perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs,
                                      addr);
+                       mm_event_end(MM_MIN_FAULT, event_ts);
                }
 
                return 0;