mm: mm_event: add read io stat
authorMinchan Kim <minchan@google.com>
Sun, 12 Aug 2018 23:15:32 +0000 (08:15 +0900)
committerPDO SCM Team <hudsoncm@motorola.com>
Fri, 15 Nov 2019 06:58:47 +0000 (00:58 -0600)
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 <minchan@google.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
Reviewed-on: https://gerrit.mot.com/1453725
Tested-by: Jira Key
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key

include/linux/mm_event.h
include/trace/events/mm_event.h
mm/filemap.c

index 81d9a72b11db9541f3a882c2fb52ec8b63459648..4d6fe7f2c97c88c93e5070b6f99c52d4eae13b4a 100644 (file)
@@ -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,
index 7d69e42bc8bd210e9793e5a281785a4e5a6f778f..6073701d900c4169d74b6b74b2a334fc88cf698d 100644 (file)
@@ -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" },                                    \
index dff99a346d67b3a2dbda1b5b6b0741da76d03de4..6a7bbb09d1b523bb7493bbcf9c9acbfdaed358ef 100644 (file)
@@ -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.
                 *