From: Huangzhaoyang <huangzhaoyang@gmail.com>
To: Nitin Gupta <ngupta@vflare.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Jens Axboe <axboe@kernel.dk>,
Johannes Weiner <hannes@cmpxchg.org>,
Minchan Kim <minchan@kernel.org>,
Zhaoyang Huang <zhaoyang.huang@unisoc.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH] mm: count zram read/write into PSI_IO_WAIT
Date: Wed, 1 Dec 2021 18:59:01 +0800 [thread overview]
Message-ID: <1638356341-17014-1-git-send-email-huangzhaoyang@gmail.com> (raw)
From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
Have zram reading/writing be counted in PSI_IO_WAIT.
Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
drivers/block/zram/zram_drv.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index fcaf275..b0e4766 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -34,6 +34,7 @@
#include <linux/debugfs.h>
#include <linux/cpuhotplug.h>
#include <linux/part_stat.h>
+#include <linux/psi.h>
#include "zram_drv.h"
@@ -1246,7 +1247,9 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index,
zram_get_element(zram, index),
bio, partial_io);
}
-
+#ifdef CONFIG_PSI
+ psi_task_change(current, 0, TSK_IOWAIT);
+#endif
handle = zram_get_handle(zram, index);
if (!handle || zram_test_flag(zram, index, ZRAM_SAME)) {
unsigned long value;
@@ -1257,6 +1260,9 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index,
zram_fill_page(mem, PAGE_SIZE, value);
kunmap_atomic(mem);
zram_slot_unlock(zram, index);
+#ifdef CONFIG_PSI
+ psi_task_change(current, TSK_IOWAIT, 0);
+#endif
return 0;
}
@@ -1284,6 +1290,9 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index,
if (WARN_ON(ret))
pr_err("Decompression failed! err=%d, page=%u\n", ret, index);
+#ifdef CONFIG_PSI
+ psi_task_change(current, TSK_IOWAIT, 0);
+#endif
return ret;
}
@@ -1471,7 +1480,13 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec,
vec.bv_offset = 0;
}
+#ifdef CONFIG_PSI
+ psi_task_change(current, 0, TSK_IOWAIT);
+#endif
ret = __zram_bvec_write(zram, &vec, index, bio);
+#ifdef CONFIG_PSI
+ psi_task_change(current, TSK_IOWAIT, 0);
+#endif
out:
if (is_partial_io(bvec))
__free_page(page);
@@ -1607,7 +1622,6 @@ static blk_qc_t zram_submit_bio(struct bio *bio)
atomic64_inc(&zram->stats.invalid_io);
goto error;
}
-
__zram_make_request(zram, bio);
return BLK_QC_T_NONE;
--
1.9.1
next reply other threads:[~2021-12-01 10:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-01 10:59 Huangzhaoyang [this message]
2021-12-01 11:12 ` Zhaoyang Huang
2021-12-02 16:28 ` Johannes Weiner
2021-12-03 9:16 ` Zhaoyang Huang
2021-12-08 16:38 ` Johannes Weiner
2021-12-08 17:45 ` Chris Down
2021-12-08 17:47 ` Chris Down
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1638356341-17014-1-git-send-email-huangzhaoyang@gmail.com \
--to=huangzhaoyang@gmail.com \
--cc=axboe@kernel.dk \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=senozhatsky@chromium.org \
--cc=zhaoyang.huang@unisoc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox