From: Chaitanya Kulkarni <kch@nvidia.com>
To: <minchan@kernel.org>, <senozhatsky@chromium.org>
Cc: <axboe@kernel.dk>, <linux-block@vger.kernel.org>,
Chaitanya Kulkarni <kch@nvidia.com>
Subject: [PATCH 1/3] zram: allow user to set QUEUE_FLAG_NOWAIT
Date: Fri, 12 May 2023 01:29:56 -0700 [thread overview]
Message-ID: <20230512082958.6550-2-kch@nvidia.com> (raw)
In-Reply-To: <20230512082958.6550-1-kch@nvidia.com>
Allow user to set the QUEUE_FLAG_NOWAIT optionally using module
parameter to retain the default behaviour. Also, update respective
allocation flags in the write path. Following are the performance
numbers with io_uring fio engine for random read, note that device has
been populated fully with randwrite workload before taking these
numbers :-
* linux-block (for-next) # grep IOPS zram*fio | column -t
default-nowait-off-1.fio: read: IOPS=802k, BW=3133MiB/s
default-nowait-off-2.fio: read: IOPS=796k, BW=3111MiB/s
default-nowait-off-3.fio: read: IOPS=796k, BW=3108MiB/s
nowait-on-1.fio: read: IOPS=857k, BW=3346MiB/s
nowait-on-2.fio: read: IOPS=857k, BW=3347MiB/s
nowait-on-3.fio: read: IOPS=858k, BW=3353MiB/s
* linux-block (for-next) # grep cpu zram*fio | column -t
default-nowait-off-1.fio: cpu : usr=5.82%, sys=13.54%, ctx=36301915
default-nowait-off-2.fio: cpu : usr=5.84%, sys=13.03%, ctx=37781937
default-nowait-off-3.fio: cpu : usr=5.84%, sys=12.90%, ctx=37492533
nowait-on-1.fio: cpu : usr=1.74%, sys=97.62%, ctx=24068,
nowait-on-2.fio: cpu : usr=1.74%, sys=97.57%, ctx=24674,
nowait-on-3.fio: cpu : usr=1.76%, sys=97.59%, ctx=24725,
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
drivers/block/zram/zram_drv.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index f6d90f1ba5cf..b2e419f15f71 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -36,6 +36,10 @@
#include "zram_drv.h"
+static bool g_nowait;
+module_param_named(nowait, g_nowait, bool, 0444);
+MODULE_PARM_DESC(nowait, "set QUEUE_FLAG_NOWAIT. Default: False");
+
static DEFINE_IDR(zram_index_idr);
/* idr index must be protected */
static DEFINE_MUTEX(zram_index_mutex);
@@ -1540,9 +1544,10 @@ static int zram_write_page(struct zram *zram, struct page *page, u32 index)
static int zram_bvec_write_partial(struct zram *zram, struct bio_vec *bvec,
u32 index, int offset, struct bio *bio)
{
- struct page *page = alloc_page(GFP_NOIO);
+ struct page *page;
int ret;
+ page = alloc_page(bio->bi_opf & REQ_NOWAIT ? GFP_NOWAIT : GFP_NOIO);
if (!page)
return -ENOMEM;
@@ -2215,6 +2220,8 @@ static int zram_add(void)
/* zram devices sort of resembles non-rotational disks */
blk_queue_flag_set(QUEUE_FLAG_NONROT, zram->disk->queue);
blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, zram->disk->queue);
+ if (g_nowait)
+ blk_queue_flag_set(QUEUE_FLAG_NOWAIT, zram->disk->queue);
/*
* To ensure that we always get PAGE_SIZE aligned
--
2.40.0
next prev parent reply other threads:[~2023-05-12 8:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 8:29 [PATCH 0/3] zram: queue flag nowait and mior cleanup Chaitanya Kulkarni
2023-05-12 8:29 ` Chaitanya Kulkarni [this message]
2023-05-12 14:31 ` [PATCH 1/3] zram: allow user to set QUEUE_FLAG_NOWAIT Christoph Hellwig
2023-05-12 14:34 ` Jens Axboe
2023-05-13 1:06 ` Chaitanya Kulkarni
2023-05-16 5:51 ` Chaitanya Kulkarni
2023-05-16 13:08 ` Sergey Senozhatsky
2023-05-16 20:41 ` Chaitanya Kulkarni
2023-05-16 20:43 ` Jens Axboe
2023-05-16 21:32 ` Chaitanya Kulkarni
2023-05-16 22:03 ` Jens Axboe
2023-05-13 1:05 ` Chaitanya Kulkarni
2023-05-12 8:29 ` [PATCH 2/3] zram: consolidate zram_bio_read()_zram_bio_write() Chaitanya Kulkarni
2023-05-12 14:32 ` Christoph Hellwig
2023-05-13 1:06 ` Chaitanya Kulkarni
2023-05-12 8:29 ` [PATCH 3/3] zram: add flush_dcache_page() call for write Chaitanya Kulkarni
2023-05-12 14: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=20230512082958.6550-2-kch@nvidia.com \
--to=kch@nvidia.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=senozhatsky@chromium.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.