mm: mm_event: add read io stat
authorMinchan Kim <minchan@google.com>
Sun, 12 Aug 2018 23:15:32 +0000 (08:15 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:24:01 +0000 (20:24 +0300)
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 64b1141fe0558ccda8a3e3989528beaf2a32cb4e..6e130a172b37c2209aec8498ca387357db944059 100644 (file)
@@ -2026,7 +2026,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)) {
@@ -2038,6 +2040,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);
@@ -2084,6 +2087,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.
                 *