blk-mq: check on cpu id when there is only one ctx mapping
Subsystems (2)
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.
--- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-mq.c +2 -1
@@ -1176,7 +1176,8 @@ 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 || +if ((rq->mq_hctx->nr_ctx ==1 && + rq->mq_ctx->cpu ==raw_smp_processor_id ()) || rq->cmd_flags &REQ_POLLED )return false;
Signature · 1 line
2.18.0
PATCH v2 1/1 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.
--- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-mq.c +2 -1
@@ -1176,7 +1176,8 @@ 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 || +if ((rq->mq_hctx->nr_ctx ==1 && + rq->mq_ctx->cpu ==raw_smp_processor_id ()) || rq->cmd_flags &REQ_POLLED )return false;
Signature · 1 line
2.18.0
Stanley Chu
Reviewed-byQuoted 5 lines · Ed Tsai
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.
Quoted 8 lines
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_ctxcheck could violate theQUEUE_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]>
Quoted 9 lines · Ed Tsai
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_ctxcheck could violate theQUEUE_FLAG_SAME_FORCE, as a result, check on cpu id when there is only one ctx mapping.
Signature · 2 lines
Regards, Alexandre
Quoted 3 lines · Ed Tsai
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.
The above sentence is incomprehensible. Please make it comprehensible.
Quoted 2 lines
Signed-off-by Ed Tsai <[email protected]>Signed-off-by Po-Wen Kao <[email protected]>
This patch comes from Keith Busch. Why has his name not been mentioned? See also https://lore.kernel.org/linux-block/[email protected]/.
Bart.