aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tsai <[email protected]>2023-06-14 08:25:29 +0800
committerJens Axboe <[email protected]>2023-06-14 11:11:25 -0600
commit30654614f3d27230200b1650f6025a2ce67900b4 (patch)
tree9f8284d7566cacc1e4428be18e6a29276cc1b794
parent6070131176af5375ae9fa24efebda41c878f4ec2 (diff)
blk-mq: check on cpu id when there is only one ctx mapping
commit f168420c62e7 ("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]>
-rw-r--r--block/blk-mq.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 1749f5890606..24dc8fe0a9d2 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1185,8 +1185,9 @@ bool blk_mq_complete_request_remote(struct request *rq)
* or a polled request, always complete locally,
* it's pointless to redirect the completion.
*/
- if (rq->mq_hctx->nr_ctx == 1 ||
- rq->cmd_flags & REQ_POLLED)
+ if ((rq->mq_hctx->nr_ctx == 1 &&
+ rq->mq_ctx->cpu == raw_smp_processor_id()) ||
+ rq->cmd_flags & REQ_POLLED)
return false;
if (blk_mq_complete_need_ipi(rq)) {