[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230718071154.21566-1-xinhuanpeng9@gmail.com>
Date: Tue, 18 Jul 2023 15:11:54 +0800
From: Huanpeng Xin <xinhuanpeng9@...il.com>
To: minchan@...nel.org, ngupta@...are.org, axboe@...nel.dk
Cc: senozhatsky@...omium.org, linux-kernel@...r.kernel.org,
linux-block@...r.kernel.org, xinhuanpeng <xinhuanpeng@...omi.com>
Subject: [PATCH] zram: set zram bio priority to REQ_PRIO.
From: xinhuanpeng <xinhuanpeng@...omi.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@...omi.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
Powered by blists - more mailing lists