Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4777429rwb; Tue, 20 Sep 2022 20:50:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DTfh27rxsaWo5rEUg4UpD84xEax36gg60QYWhkiV70TOwurXJ6whyyBpzvwHdE2mXyLzZ X-Received: by 2002:a63:1450:0:b0:439:3806:9b91 with SMTP id 16-20020a631450000000b0043938069b91mr23103173pgu.407.1663732245099; Tue, 20 Sep 2022 20:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663732245; cv=none; d=google.com; s=arc-20160816; b=ls6HoPOdaUDQEXeANEvsX1jZaHWZp4FhG2r1Rfnl85rnsTpf1yusfEkqp1VTg3Grt3 RdjOdNHLFmkFZaRDbEQK6xgn0aaDVH5jrtyK1Awxm9DrspHFd+rljQh16Rz2Y1U8rqBE LcpEL+SxgxMyWkTStY5lcS3uxb430+xo96AEzeONsoR5MmEkz7wh0f1dfKP/lP8Di5Fd l95pfElmeh8r+bpMLpTxDhVKYG2rlOHR1lRd0sa2kCRjy2bWIPpJ5xUwKh/OAvylmQ7D zreM+gU9YCrRno6z7sBbTa5vdHtSvfaXhyMj60mijOhpKR35gNa09HoFmTs25Yx546mp i5WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=25uHmHkom0KWpglkuzYH+KTQX4mVeotpRntQ3Pqgfq8=; b=R4ruXhGkrUAa/s4Lyfp7DwTGj9J61Gz27elQbMK/+YLcx6BXM/cyGd/1vmH8V77RgL atOwnosz9SNgo2z/Dbs4E6bHatkcC7UNIBEtLgXlxXF15Ze5aZUhw+TG8hius7igvDmC kKw9Rv6UcxpnXvTPM2D3NO43ok0gEOf3J6xDPQk2TZA1q52V/l3O7bOV45b46eppDd7l SsRodYb8mJpcdq0LKZHw2Fv+8DPhW3aYH5IHylWEWOMI8G0k7pAz5rJeyWwyrC8bqR9T 9UZavpuQEMvX7hzKKC4LcalYZmmrF8RsjLcPI9jlOftCivxOoiBY7+ajZbZl2jhU68ML Z4uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u16-20020a63b550000000b004350783ee63si1552874pgo.237.2022.09.20.20.50.32; Tue, 20 Sep 2022 20:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231451AbiIUDf3 (ORCPT + 99 others); Tue, 20 Sep 2022 23:35:29 -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> X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SORTED_RECIPS,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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