From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Bart Van Assche <bvanassche@acm.org>,
Damien Le Moal <dlemoal@kernel.org>,
Ming Lei <ming.lei@redhat.com>, Mike Snitzer <snitzer@kernel.org>
Subject: [PATCH v4 3/7] block: Send requeued requests to the I/O scheduler
Date: Wed, 21 Jun 2023 13:12:30 -0700 [thread overview]
Message-ID: <20230621201237.796902-4-bvanassche@acm.org> (raw)
In-Reply-To: <20230621201237.796902-1-bvanassche@acm.org>
Send requeued requests to the I/O scheduler if the dispatch order
matters such that the I/O scheduler can control the order in which
requests are dispatched.
This patch reworks commit aef1897cd36d ("blk-mq: insert rq with DONTPREP
to hctx dispatch list when requeue"). Instead of sending DONTPREP
requests to the dispatch list, send these to the I/O scheduler and
prevent that the I/O scheduler merges these requests by adding
RQF_DONTPREP to the list of flags that prevent merging
(RQF_NOMERGE_FLAGS).
Cc: Christoph Hellwig <hch@lst.de>
Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
block/blk-mq.c | 10 +++++-----
include/linux/blk-mq.h | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index f440e4aaaae3..453a90767f7a 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1453,13 +1453,13 @@ static void blk_mq_requeue_work(struct work_struct *work)
while (!list_empty(&requeue_list)) {
rq = list_entry(requeue_list.next, struct request, queuelist);
/*
- * If RQF_DONTPREP ist set, the request has been started by the
- * driver already and might have driver-specific data allocated
- * already. Insert it into the hctx dispatch list to avoid
- * block layer merges for the request.
+ * Only send those RQF_DONTPREP requests to the dispatch list
+ * that may be reordered freely. If the request order matters,
+ * send the request to the I/O scheduler.
*/
list_del_init(&rq->queuelist);
- if (rq->rq_flags & RQF_DONTPREP)
+ if (rq->rq_flags & RQF_DONTPREP &&
+ !op_needs_zoned_write_locking(req_op(rq)))
blk_mq_request_bypass_insert(rq, 0);
else
blk_mq_insert_request(rq, BLK_MQ_INSERT_AT_HEAD);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index f401067ac03a..2610b299ec77 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -62,8 +62,8 @@ typedef __u32 __bitwise req_flags_t;
#define RQF_RESV ((__force req_flags_t)(1 << 23))
/* flags that prevent us from merging requests: */
-#define RQF_NOMERGE_FLAGS \
- (RQF_STARTED | RQF_FLUSH_SEQ | RQF_SPECIAL_PAYLOAD)
+#define RQF_NOMERGE_FLAGS \
+ (RQF_STARTED | RQF_FLUSH_SEQ | RQF_DONTPREP | RQF_SPECIAL_PAYLOAD)
enum mq_rq_state {
MQ_RQ_IDLE = 0,
next prev parent reply other threads:[~2023-06-21 20:12 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 20:12 [PATCH v4 0/7] Submit zoned writes in order Bart Van Assche
2023-06-21 20:12 ` [PATCH v4 1/7] block: Rename a local variable in blk_mq_requeue_work() Bart Van Assche
2023-06-22 1:15 ` Damien Le Moal
2023-06-21 20:12 ` [PATCH v4 2/7] block: Simplify blk_mq_requeue_work() Bart Van Assche
2023-06-22 1:16 ` Damien Le Moal
2023-06-23 5:45 ` Christoph Hellwig
2023-06-21 20:12 ` Bart Van Assche [this message]
2023-06-22 1:19 ` [PATCH v4 3/7] block: Send requeued requests to the I/O scheduler Damien Le Moal
2023-06-22 17:23 ` Bart Van Assche
2023-06-22 21:50 ` Damien Le Moal
2023-06-21 20:12 ` [PATCH v4 4/7] block: One requeue list per hctx Bart Van Assche
2023-06-23 5:48 ` Christoph Hellwig
2023-06-26 8:09 ` Ming Lei
2023-06-26 16:54 ` Bart Van Assche
2023-06-27 1:06 ` Ming Lei
2023-06-21 20:12 ` [PATCH v4 5/7] block: Preserve the order of requeued requests Bart Van Assche
2023-06-23 5:50 ` Christoph Hellwig
2023-06-23 20:08 ` Bart Van Assche
2023-06-26 8:01 ` Christoph Hellwig
2023-06-26 8:16 ` Ming Lei
2023-06-21 20:12 ` [dm-devel] [PATCH v4 6/7] dm: Inline __dm_mq_kick_requeue_list() Bart Van Assche
2023-06-21 20:12 ` Bart Van Assche
2023-06-21 20:12 ` [dm-devel] [PATCH v4 7/7] block: Inline blk_mq_{, delay_}kick_requeue_list() Bart Van Assche
2023-06-21 20:12 ` [PATCH v4 7/7] block: Inline blk_mq_{,delay_}kick_requeue_list() Bart Van Assche
2023-06-22 7:31 ` [dm-devel] [PATCH v4 7/7] block: Inline blk_mq_{, delay_}kick_requeue_list() Roger Pau Monné
2023-06-22 7:31 ` [PATCH v4 7/7] block: Inline blk_mq_{,delay_}kick_requeue_list() Roger Pau Monné
2023-06-23 5:52 ` [dm-devel] [PATCH v4 7/7] block: Inline blk_mq_{, delay_}kick_requeue_list() Christoph Hellwig
2023-06-23 5:52 ` [PATCH v4 7/7] block: Inline blk_mq_{,delay_}kick_requeue_list() 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=20230621201237.796902-4-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=dlemoal@kernel.org \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=snitzer@kernel.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.