Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1551928rwb; Sun, 18 Sep 2022 09:20:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OWN10iQwPWYYoxyZ+Dq9LtqEOZdq73hg5/PicYjduEFN8Q1Fjv901QZ/ScO+R/a1O9rGO X-Received: by 2002:a62:84c6:0:b0:538:3c39:5819 with SMTP id k189-20020a6284c6000000b005383c395819mr14960368pfd.4.1663518040774; Sun, 18 Sep 2022 09:20:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663518040; cv=none; d=google.com; s=arc-20160816; b=nrLd36+o+FQn9wLAwVd9Ram0SxMdRXsTQ+43OZVZok+M65EHukijOCbrL3z0PxY5eA sxNG0KN5MI58yGzDY9VZGQyjVRQJ4JuR5OqPK8CvZXttsCwI18UVES8Bu9mRy+jKMXJT oeooJyK5K96qBK1K2NeXTmfXD8g9BwnlfwFdSCtqH70tjL6yhCzfE4XwVhaR2rtvHyiX 5u6Y+UKi1+iEeafOgP95vEwL5Aa+K09XWYXHpsH044UOyHbSJ5jnqelkDDbBxrc/DLjK Z6QWtK7HE+yyeKLhYQ9DglakFm4l9lTD76W67lalllXw2iH/+1gwAkRuwUyJz4iASNAX S+Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=W+AO7U6rbzNweEuYBd2ieEx4GN79koF6S4GZfhXV5mc=; b=snHdVA+iNYO1F18hQBynuhCPg13RU6Lc0dXw3Vnsr2Ujm13gx+0XPXm7R5KGXuzI5b TM1wkAmwAiJHCDaI3xiz441Z+Jnli6khHm+GhWg62Rwhywcr/zuqGgEMYrG6jaaM5ga3 BQK2mrOLa74iBivFTjMBCx2Ijzz/Z4+8++ZQBrrVH0r5/XpJ18qke8SCmRxI4G1e1LzW 783J9YPDM8ebccbHYctfraYKp2vSy3KGB03XGi+liBTzrK8Kld49RFvJY2h6fMw3EsiR X9pMj3/7gsO+KmD2+T7K/2kso1E4Ql7OW2XGjkxxmQNeWDI87SlNNRGW2f+mx1W5PTCT pyNA== 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 c22-20020a056a000ad600b005409c35a01dsi16956070pfl.351.2022.09.18.09.20.28; Sun, 18 Sep 2022 09:20:40 -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 S229679AbiIRQK0 (ORCPT + 99 others); Sun, 18 Sep 2022 12:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbiIRQKY (ORCPT ); Sun, 18 Sep 2022 12:10:24 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A022E1180F for ; Sun, 18 Sep 2022 09:10:22 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R431e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=liusong@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VQ2jLUb_1663517416; Received: from 30.39.108.176(mailfrom:liusong@linux.alibaba.com fp:SMTPD_---0VQ2jLUb_1663517416) by smtp.aliyun-inc.com; Mon, 19 Sep 2022 00:10:17 +0800 Message-ID: <7b28925a-cbee-620f-fde7-d16f256836cc@linux.alibaba.com> Date: Mon, 19 Sep 2022 00:10:15 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [RFC PATCH] nvme: request remote is usually not involved for nvme devices To: Jens Axboe , kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org References: <1663432858-99743-1-git-send-email-liusong@linux.alibaba.com> From: Liu Song In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,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 On 2022/9/18 00:50, Jens Axboe wrote: > On 9/17/22 10:40 AM, Liu Song wrote: >> 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. > If the worry is the call overhead of blk_mq_complete_request_remote(), > why don't we just make that available as an inline instead? That seems > vastly superior to providing a random shortcut in a driver to avoid > calling it. Hi This is what I think about it. If it is an SSD with only one hw queue, remote requests will appear occasionally. As a real multi-queue device, nvme usually does not have remote requests, so we don't need to care about it. So even if "blk_mq_complete_request_remote" is called, there is a high probability that it will return false, and the cost of changing the call to "blk_mq_complete_request_remote" to determine whether "req->mq_hctx->nr_ctx" is 1 is not only a function call, but more judgments in "blk_mq_complete_request_remote". If "blk_mq_complete_request_remote" is decorated as inline, it also depends on the compiler, there is uncertainty. Thanks