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.

Bug: 80168800
Bug: 116825053
Bug: 153442668
Test: boot
Change-Id: I761b7110339cf1e5ef24530ad32aedd784d00d07
Signed-off-by: Minchan Kim <minchan@google.com>
(cherry picked from commit 1736bcfef806a113b17df6b05c1d8dfa6ee04d47)
Signed-off-by: Martin Liu <liumartin@google.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
This commit is contained in:
Minchan Kim 2019-04-23 11:41:08 +08:00 committed by spakkkk
parent 94291995b6
commit b3c98b66c0
3 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,7 @@
enum mm_event_type { enum mm_event_type {
MM_MIN_FAULT = 0, MM_MIN_FAULT = 0,
MM_MAJ_FAULT, MM_MAJ_FAULT,
MM_READ_IO,
MM_COMPACTION, MM_COMPACTION,
MM_RECLAIM, MM_RECLAIM,
MM_SWP_FAULT, MM_SWP_FAULT,

View File

@ -14,6 +14,7 @@ struct mm_event_task;
__print_symbolic(type, \ __print_symbolic(type, \
{ MM_MIN_FAULT, "min_flt" }, \ { MM_MIN_FAULT, "min_flt" }, \
{ MM_MAJ_FAULT, "maj_flt" }, \ { MM_MAJ_FAULT, "maj_flt" }, \
{ MM_READ_IO, "read_io" }, \
{ MM_COMPACTION, "compaction" }, \ { MM_COMPACTION, "compaction" }, \
{ MM_RECLAIM, "reclaim" }, \ { MM_RECLAIM, "reclaim" }, \
{ MM_SWP_FAULT, "swp_flt" }, \ { MM_SWP_FAULT, "swp_flt" }, \

View File

@ -2190,6 +2190,7 @@ static ssize_t generic_file_buffered_read(struct kiocb *iocb,
pgoff_t end_index; pgoff_t end_index;
loff_t isize; loff_t isize;
unsigned long nr, ret; unsigned long nr, ret;
ktime_t event_ts = 0;
cond_resched(); cond_resched();
find_page: find_page:
@ -2200,6 +2201,7 @@ find_page:
page = find_get_page(mapping, index); page = find_get_page(mapping, index);
if (!page) { if (!page) {
mm_event_start(&event_ts);
if (iocb->ki_flags & IOCB_NOWAIT) if (iocb->ki_flags & IOCB_NOWAIT)
goto would_block; goto would_block;
page_cache_sync_readahead(mapping, page_cache_sync_readahead(mapping,
@ -2248,6 +2250,8 @@ find_page:
unlock_page(page); unlock_page(page);
} }
page_ok: 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. * i_size must be checked after we know the page is Uptodate.
* *