Re: [PATCH] zram: set zram bio priority to REQ_PRIO.

From: Sergey Senozhatsky
Date: Tue Jul 18 2023 - 03:49:42 EST


Cc-ing Christoph

On (23/07/18 15:11), Huanpeng Xin wrote:
>
> When the system memory pressure is high, set zram bio priority
> to REQ_PRIO can quickly swap zarm's memory to backing device,

read_from_bdev_async() does the opposite.

[..]
> @@ -616,7 +616,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec,
> {
> + bio = bio_alloc(zram->bdev, 1, parent ? parent->bi_opf : REQ_OP_READ | REQ_PRIO,
> GFP_NOIO);

[..]

> @@ -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);

In general, zram writeback is not for situations when the system
is critically low on memory; performance there is not that important,
so I'm not sure whether we want to boost requests' priorities.