Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit f168420

Browse files
ifishlandaxboe
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 81c7a63 commit f168420

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

block/blk-mq.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,10 +1093,12 @@ bool blk_mq_complete_request_remote(struct request *rq)
10931093
WRITE_ONCE(rq->state, MQ_RQ_COMPLETE);
10941094

10951095
/*
1096-
* For a polled request, always complete locally, it's pointless
1097-
* to redirect the completion.
1096+
* For request which hctx has only one ctx mapping,
1097+
* or a polled request, always complete locally,
1098+
* it's pointless to redirect the completion.
10981099
*/
1099-
if (rq->cmd_flags & REQ_POLLED)
1100+
if (rq->mq_hctx->nr_ctx == 1 ||
1101+
rq->cmd_flags & REQ_POLLED)
11001102
return false;
11011103

11021104
if (blk_mq_complete_need_ipi(rq)) {

0 commit comments

Comments
 (0)