From: Minchan Kim Date: Sun, 12 Aug 2018 23:15:32 +0000 (+0900) Subject: mm: mm_event: add read io stat X-Git-Tag: MMI-RSBS31.Q1-48-36-26~79 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a42ad457105266a3cb76b38028d950c2124fc627;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git mm: mm_event: add read io stat Read IO's latency as well as filemap fault could affect system performance so this patch keeps track it on. Mot-CRs-fixed: (CR) Bug: 80168800 Change-Id: I761b7110339cf1e5ef24530ad32aedd784d00d07 Signed-off-by: Minchan Kim Signed-off-by: Cho KyongHo Reviewed-on: https://gerrit.mot.com/1453725 Tested-by: Jira Key SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- diff --git a/include/linux/mm_event.h b/include/linux/mm_event.h index 81d9a72b11db..4d6fe7f2c97c 100644 --- a/include/linux/mm_event.h +++ b/include/linux/mm_event.h @@ -8,6 +8,7 @@ enum mm_event_type { MM_MIN_FAULT = 0, MM_MAJ_FAULT, + MM_READ_IO, MM_COMPACTION, MM_RECLAIM, MM_SWP_FAULT, diff --git a/include/trace/events/mm_event.h b/include/trace/events/mm_event.h index 7d69e42bc8bd..6073701d900c 100644 --- a/include/trace/events/mm_event.h +++ b/include/trace/events/mm_event.h @@ -14,6 +14,7 @@ struct mm_event_task; __print_symbolic(type, \ { MM_MIN_FAULT, "min_flt" }, \ { MM_MAJ_FAULT, "maj_flt" }, \ + { MM_READ_IO, "read_io" }, \ { MM_COMPACTION, "compaction" }, \ { MM_RECLAIM, "reclaim" }, \ { MM_SWP_FAULT, "swp_flt" }, \ diff --git a/mm/filemap.c b/mm/filemap.c index dff99a346d67..6a7bbb09d1b5 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1980,7 +1980,9 @@ static ssize_t generic_file_buffered_read(struct kiocb *iocb, pgoff_t end_index; loff_t isize; unsigned long nr, ret; + ktime_t event_ts; + event_ts = 0; cond_resched(); find_page: if (fatal_signal_pending(current)) { @@ -1992,6 +1994,7 @@ find_page: if (!page) { if (iocb->ki_flags & IOCB_NOWAIT) goto would_block; + mm_event_start(&event_ts); page_cache_sync_readahead(mapping, ra, filp, index, last_index - index); @@ -2038,6 +2041,8 @@ find_page: unlock_page(page); } page_ok: + if (event_ts != 0) + mm_event_end(MM_READ_IO, event_ts); /* * i_size must be checked after we know the page is Uptodate. *