Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp565698rwb; Sat, 17 Sep 2022 10:08:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gOmhJ9IhKdA9iGHFesSqVj2dfSEhMmxIhthkuyvAjsfWxVMLBRe404K9ivctZ5Yu1DZN3 X-Received: by 2002:a17:90b:1d05:b0:202:809c:2d52 with SMTP id on5-20020a17090b1d0500b00202809c2d52mr11191493pjb.215.1663434492680; Sat, 17 Sep 2022 10:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663434492; cv=none; d=google.com; s=arc-20160816; b=BSCE+jF6Nrv0pHTxrWk2/g2vPpeISeQwUjBFPkthehsqr3xcLu3RtCh6UBANdoXYJr +64OyT0Lh5b1uAHUe5w+dPWJC7+QR8UsVuxtSJHwYE2UalppYAGirRiNCIihpzXSSdjE vx0Bh6nSY5EObGGiYdQiE59JBPlr2q4+RhlnEs/O9RZ/jdFs5kFmG72zwjz2EF6wndZS x3fVU/4uhWmnG5NGBrbO/Xbl9Tzu+Th1PHTyDFt6k/sVNthqw5n3F9VYDtWgqHuHOWrm 2LCAcN5jkrqW+n4PR92o2+pKu0WfoC+AbmRuFRmyctmgQvUPla+lBiHtUOuERl54KfaM civg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=kjdUm7Zas4EOzX2PTotuzTaNFY8GH8PLvM2npCp3dYc=; b=cZNnraT12xLUB+q1Fr9nIKyJlBj7Q6dfqJD8+N+VjYVrp0lVBkIHJbuHInitmAxb37 aHvaGJfecNtuzRh7iIMphFzi4X5CAfsSBKqcGSYKJYIfM0YSd34/dMRKEhSHgxQoRWYI 3rtrbdjkS4cgHHaYv4Alu6Ofc8obTPn0CIcnHcqX2ynM8do9GOjJgTdl+FHxDAEaGQoI FDAMOKl3ZUBBV6+Ds74zx+o4KawuTJn0Jo9ehtMpMy6yvvDBjAXzNLkrGezLLrYUw+3v axBatvXYpuai9K3hou0NAZhkcdzcWZamK3Q2KD+zar2OsaZ8q5JWQlvbnqDZLlXdxOri L1gg== 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 q18-20020a656a92000000b0042b438eeee1si27749030pgu.148.2022.09.17.10.08.00; Sat, 17 Sep 2022 10:08:12 -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 S229671AbiIQQle (ORCPT + 99 others); Sat, 17 Sep 2022 12:41:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiIQQlb (ORCPT ); Sat, 17 Sep 2022 12:41:31 -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 C52D82ED4B for ; Sat, 17 Sep 2022 09:41:29 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R391e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=liusong@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VQ.PTTI_1663432858; Received: from localhost(mailfrom:liusong@linux.alibaba.com fp:SMTPD_---0VQ.PTTI_1663432858) by smtp.aliyun-inc.com; Sun, 18 Sep 2022 00:41:21 +0800 From: Liu Song To: kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] nvme: request remote is usually not involved for nvme devices Date: Sun, 18 Sep 2022 00:40:58 +0800 Message-Id: <1663432858-99743-1-git-send-email-liusong@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham 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 NVMe devices usually have a 1:1 mapping between "ctx" and "hctx", so when "nr_ctx" is equal to 1, there is no possibility of remote request, so the corresponding process can be simplified. Signed-off-by: Liu Song --- drivers/nvme/host/nvme.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 216acbe..cc21896 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -672,6 +672,10 @@ static inline bool nvme_try_complete_req(struct request *req, __le16 status, nvme_should_fail(req); if (unlikely(blk_should_fake_timeout(req->q))) return true; + if (likely(req->mq_hctx->nr_ctx == 1)) { + WRITE_ONCE(req->state, MQ_RQ_COMPLETE); + return false; + } return blk_mq_complete_request_remote(req); } -- 1.8.3.1