From nobody Thu Apr 2 19:54:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2239C32771 for ; Wed, 21 Sep 2022 03:35:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229775AbiIUDfc (ORCPT ); Tue, 20 Sep 2022 23:35:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231837AbiIUDeU (ORCPT ); Tue, 20 Sep 2022 23:34:20 -0400 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA5D62A243 for ; Tue, 20 Sep 2022 20:32:40 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R241e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=liusong@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VQM4M10_1663731123; Received: from localhost(mailfrom:liusong@linux.alibaba.com fp:SMTPD_---0VQM4M10_1663731123) by smtp.aliyun-inc.com; Wed, 21 Sep 2022 11:32:37 +0800 From: Liu Song To: axboe@kernel.dk Cc: hch@lst.de, kbusch@kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, liusong@linux.alibaba.com, sagi@grimberg.me Subject: [RFC PATCH] blk-mq: hctx has only one ctx mapping is no need to redirect the completion Date: Wed, 21 Sep 2022 11:32:03 +0800 Message-Id: <1663731123-81536-1-git-send-email-liusong@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <894e18a4-4504-df48-6429-a04c222ca064@kernel.dk> References: <894e18a4-4504-df48-6429-a04c222ca064@kernel.dk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Liu Song High-performance NVMe devices usually support a large hw queue, 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 --- block/blk-mq.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index c11949d..9626ea1 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1093,10 +1093,12 @@ bool blk_mq_complete_request_remote(struct request = *rq) WRITE_ONCE(rq->state, MQ_RQ_COMPLETE); =20 /* - * 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 =3D=3D 1 || + rq->cmd_flags & REQ_POLLED) return false; =20 if (blk_mq_complete_need_ipi(rq)) { --=20 1.8.3.1