]> Git Repo - linux.git/commitdiff
blk-mq: don't redirect completion for hctx withs only one ctx mapping
authorLiu Song <[email protected]>
Wed, 21 Sep 2022 03:32:03 +0000 (11:32 +0800)
committerJens Axboe <[email protected]>
Sat, 24 Sep 2022 15:02:30 +0000 (09:02 -0600)
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]>
block/blk-mq.c

index 29bb48de5bda7b68ea4371770516c4e7565de142..496085132899250cc8f8b6bc536f7ab9cf017cf4 100644 (file)
@@ -1093,10 +1093,12 @@ bool blk_mq_complete_request_remote(struct request *rq)
        WRITE_ONCE(rq->state, MQ_RQ_COMPLETE);
 
        /*
-        * For a polled request, always complete locally, it's pointless
-        * to redirect the completion.
+        * For request which hctx has only one ctx mapping,
+        * or a polled request, always complete locally,
+        * it's pointless to redirect the completion.
         */
-       if (rq->cmd_flags & REQ_POLLED)
+       if (rq->mq_hctx->nr_ctx == 1 ||
+               rq->cmd_flags & REQ_POLLED)
                return false;
 
        if (blk_mq_complete_need_ipi(rq)) {
This page took 0.065655 seconds and 4 git commands to generate.