* [PATCH v3] blk-mq: check on cpu id when there is only one ctx mapping
@ 2023-06-14 0:25 Ed Tsai
2023-06-14 6:19 ` Christoph Hellwig
2023-06-14 17:11 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Ed Tsai @ 2023-06-14 0:25 UTC (permalink / raw
To: axboe
Cc: matthias.bgg, angelogioacchino.delregno, linux-block,
linux-kernel, linux-arm-kernel, linux-mediatek, kbusch, amergnat,
liusong, wsd_upstream, peter.wang, stanley.chu, powen.kao,
alice.chao, naomi.chu, Chun-Hung.Wu, Ed Tsai
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 <ed.tsai@mediatek.com>
Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com>
Suggested-by: Keith Busch <kbusch@kernel.org>
---
block/blk-mq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 41f7e2b500bd..ecc30ebe9483 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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;
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] blk-mq: check on cpu id when there is only one ctx mapping
2023-06-14 0:25 [PATCH v3] blk-mq: check on cpu id when there is only one ctx mapping Ed Tsai
@ 2023-06-14 6:19 ` Christoph Hellwig
2023-06-14 17:11 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2023-06-14 6:19 UTC (permalink / raw
To: Ed Tsai
Cc: axboe, matthias.bgg, angelogioacchino.delregno, linux-block,
linux-kernel, linux-arm-kernel, linux-mediatek, kbusch, amergnat,
liusong, wsd_upstream, peter.wang, stanley.chu, powen.kao,
alice.chao, naomi.chu, Chun-Hung.Wu
This looks fine to me:
Reviewed-by: Christoph Hellwig <hch@lst.de>
> - 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)
But please fix the incorrct indentation in the existing code here
please while you're at it (maybe Jens can just fold it in):
if ((rq->mq_hctx->nr_ctx == 1 &&
rq->mq_ctx->cpu == raw_smp_processor_id()) ||
(rq->cmd_flags & REQ_POLLED))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] blk-mq: check on cpu id when there is only one ctx mapping
2023-06-14 0:25 [PATCH v3] blk-mq: check on cpu id when there is only one ctx mapping Ed Tsai
2023-06-14 6:19 ` Christoph Hellwig
@ 2023-06-14 17:11 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2023-06-14 17:11 UTC (permalink / raw
To: Ed Tsai
Cc: matthias.bgg, angelogioacchino.delregno, linux-block,
linux-kernel, linux-arm-kernel, linux-mediatek, kbusch, amergnat,
liusong, wsd_upstream, peter.wang, stanley.chu, powen.kao,
alice.chao, naomi.chu, Chun-Hung.Wu
On Wed, 14 Jun 2023 08:25:29 +0800, Ed Tsai wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] blk-mq: check on cpu id when there is only one ctx mapping
commit: 30654614f3d27230200b1650f6025a2ce67900b4
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-14 17:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-14 0:25 [PATCH v3] blk-mq: check on cpu id when there is only one ctx mapping Ed Tsai
2023-06-14 6:19 ` Christoph Hellwig
2023-06-14 17:11 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).