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

Commit 3065461

Browse files
Ed Tsaiaxboe
authored andcommitted
blk-mq: check on cpu id when there is only one ctx mapping
commit f168420 ("blk-mq: don't redirect completion for hctx withs only one ctx mapping") When nvme applies a 1:1 mapping of hctx and ctx, there will be no remote request. But for ufs, the submission and completion queues could be asymmetric. (e.g. Multiple SQs share one CQ) Therefore, 1:1 mapping of hctx and ctx won't complete request on the submission cpu. In this situation, this nr_ctx check could violate the QUEUE_FLAG_SAME_FORCE, as a result, check on cpu id when there is only one ctx mapping. Signed-off-by: Ed Tsai <[email protected]> Signed-off-by: Po-Wen Kao <[email protected]> Suggested-by: Keith Busch <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] [axboe: fixed up indentation] Signed-off-by: Jens Axboe <[email protected]>
1 parent 6070131 commit 3065461

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

block/blk-mq.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,8 +1185,9 @@ bool blk_mq_complete_request_remote(struct request *rq)
11851185
* or a polled request, always complete locally,
11861186
* it's pointless to redirect the completion.
11871187
*/
1188-
if (rq->mq_hctx->nr_ctx == 1 ||
1189-
rq->cmd_flags & REQ_POLLED)
1188+
if ((rq->mq_hctx->nr_ctx == 1 &&
1189+
rq->mq_ctx->cpu == raw_smp_processor_id()) ||
1190+
rq->cmd_flags & REQ_POLLED)
11901191
return false;
11911192

11921193
if (blk_mq_complete_need_ipi(rq)) {

0 commit comments

Comments
 (0)