From: Huanpeng Xin <xinhuanpeng9@gmail.com>
To: minchan@kernel.org, ngupta@vflare.org, axboe@kernel.dk
Cc: senozhatsky@chromium.org, linux-kernel@vger.kernel.org,
linux-block@vger.kernel.org, xinhuanpeng <xinhuanpeng@xiaomi.com>
Subject: [PATCH] zram: set zram bio priority to REQ_PRIO.
Date: Tue, 18 Jul 2023 15:11:54 +0800 [thread overview]
Message-ID: <20230718071154.21566-1-xinhuanpeng9@gmail.com> (raw)
From: xinhuanpeng <xinhuanpeng@xiaomi.com>
When the system memory pressure is high, set zram bio priority
to REQ_PRIO can quickly swap zarm's memory to backing device,
freeing up more space for zram.
Signed-off-by: xinhuanpeng <xinhuanpeng@xiaomi.com>
---
drivers/block/zram/zram_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index b8549c61ff2c..af56766a036b 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -616,7 +616,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec,
{
struct bio *bio;
- bio = bio_alloc(zram->bdev, 1, parent ? parent->bi_opf : REQ_OP_READ,
+ bio = bio_alloc(zram->bdev, 1, parent ? parent->bi_opf : REQ_OP_READ | REQ_PRIO,
GFP_NOIO);
if (!bio)
return -ENOMEM;
@@ -746,7 +746,7 @@ static ssize_t writeback_store(struct device *dev,
}
bio_init(&bio, zram->bdev, &bio_vec, 1,
- REQ_OP_WRITE | REQ_SYNC);
+ REQ_OP_WRITE | REQ_SYNC | REQ_PRIO);
bio.bi_iter.bi_sector = blk_idx * (PAGE_SIZE >> 9);
bio_add_page(&bio, bvec.bv_page, bvec.bv_len,
--
2.37.2
next reply other threads:[~2023-07-18 7:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 7:11 Huanpeng Xin [this message]
2023-07-18 7:49 ` [PATCH] zram: set zram bio priority to REQ_PRIO Sergey Senozhatsky
2023-07-18 11:51 ` Sergey Senozhatsky
2023-07-20 8:34 ` Christoph Hellwig
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=20230718071154.21566-1-xinhuanpeng9@gmail.com \
--to=xinhuanpeng9@gmail.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=senozhatsky@chromium.org \
--cc=xinhuanpeng@xiaomi.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