From: Minchan Kim Date: Wed, 27 Jun 2018 12:54:47 +0000 (+0900) Subject: mm: mm_event: add page fault stat X-Git-Url: https://git.stricted.de/?p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git;a=commitdiff_plain;h=35dd923d61775abc91afc5ab7ce2dcf00a66b215;hp=d2a22b87a9fc50e07c0427cef2b36c6e1a3ce56b mm: mm_event: add page fault stat 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 Signed-off-by: Cho KyongHo Reviewed-on: https://gerrit.mot.com/1453720 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 692043e0021e..6a9520698944 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -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;