From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24761C32771 for ; Wed, 21 Sep 2022 03:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=25uHmHkom0KWpglkuzYH+KTQX4mVeotpRntQ3Pqgfq8=; b=1Of70xsLXnsT+1qBplC5Q/VzAv C/EN7C9trfLn0Y0WFo4od11znWW2JrQFXsAbi+xv1DdlCcn8CcK8QXIJ0UCmTW85kR6j0TkqG7YdJ V6ixEXGsxrOl2hQ58getMryf13PoiWjoCeOcPNRZ/9iVZfw/knrqEBHpVy6fSKIigfJoNPDmHBCbR ymXW48Kteflk5R+6qc3CP1JMwJexJZZ7aOhmJQ1W/Hs9ih8132hKaMQt+DBrdNn8C3IzfViD1yl4T oPRZq8QaGCrLPONkgOwcy6cstvU4/AkkPKVPG9uhwOYOmP5tSGe3BF9zHC+F8SYegnt2MFB9MtPa7 gHrSO+PA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaqTv-008ZYF-Ai; Wed, 21 Sep 2022 03:33:03 +0000 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaqTa-008ZHR-LS for linux-nvme@lists.infradead.org; Wed, 21 Sep 2022 03:32:44 +0000 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220920_203242_911763_6E36B478 X-CRM114-Status: GOOD ( 10.62 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org 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); /* - * 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)) { -- 1.8.3.1