summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorLiu Song <liusong@linux.alibaba.com>2022-09-21 11:32:03 +0800
committerJens Axboe <axboe@kernel.dk>2022-09-24 09:02:30 -0600
commitf168420c62e7a106961f2489a89f6ade84fe3f27 (patch)
treedf4dbd2492ff7150eebfdafb3135ae8a242556d8 /block
parent81c7a63abc7c0be572b4f853e913ce93a34f6e1b (diff)
downloadlinux-f168420c62e7a106961f2489a89f6ade84fe3f27.tar.bz2
blk-mq: don't redirect completion for hctx withs only one ctx mapping
High-performance NVMe devices usually support a large hw queues, 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> Link: https://lore.kernel.org/r/1663731123-81536-1-git-send-email-liusong@linux.alibaba.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 29bb48de5bda..496085132899 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)) {