From: Liu Song <liusong@linux.alibaba.com>
To: axboe@kernel.dk
Cc: hch@lst.de, kbusch@kernel.org, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, liusong@linux.alibaba.com,
sagi@grimberg.me
Subject: [RFC PATCH] blk-mq: hctx has only one ctx mapping is no need to redirect the completion
Date: Wed, 21 Sep 2022 11:32:03 +0800 [thread overview]
Message-ID: <1663731123-81536-1-git-send-email-liusong@linux.alibaba.com> (raw)
In-Reply-To: <894e18a4-4504-df48-6429-a04c222ca064@kernel.dk>
From: Liu Song <liusong@linux.alibaba.com>
High-performance NVMe devices usually support a large hw queue, which
ensures a 1:1 mapping of hctx and ctx. In this case there will be no
remote request, so we don't need to care about it.
Signed-off-by: Liu Song <liusong@linux.alibaba.com>
---
block/blk-mq.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index c11949d..9626ea1 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1093,10 +1093,12 @@ bool blk_mq_complete_request_remote(struct request *rq)
WRITE_ONCE(rq->state, MQ_RQ_COMPLETE);
/*
- * For a polled request, always complete locally, it's pointless
- * to redirect the completion.
+ * For request which hctx has only one ctx mapping,
+ * or a polled request, always complete locally,
+ * it's pointless to redirect the completion.
*/
- if (rq->cmd_flags & REQ_POLLED)
+ if (rq->mq_hctx->nr_ctx == 1 ||
+ rq->cmd_flags & REQ_POLLED)
return false;
if (blk_mq_complete_need_ipi(rq)) {
--
1.8.3.1
next prev parent reply other threads:[~2022-09-21 3:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-17 16:40 [RFC PATCH] nvme: request remote is usually not involved for nvme devices Liu Song
2022-09-17 16:50 ` Jens Axboe
2022-09-18 16:10 ` Liu Song
2022-09-19 14:10 ` Jens Axboe
2022-09-19 14:35 ` Christoph Hellwig
2022-09-21 3:40 ` Liu Song
2022-09-21 3:32 ` Liu Song [this message]
2022-09-22 6:20 ` [RFC PATCH] blk-mq: hctx has only one ctx mapping is no need to redirect the completion Christoph Hellwig
2022-09-22 7:17 ` Liu Song
2022-09-22 8:27 ` [RFC PATCH v2] " Liu Song
2022-09-24 15:03 ` [RFC PATCH] " Jens Axboe
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=1663731123-81536-1-git-send-email-liusong@linux.alibaba.com \
--to=liusong@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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