Message ID | cover.1682941568.git.christophe.jaillet@wanadoo.fr |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2665060vqo; Mon, 1 May 2023 05:42:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4svZHsg4+CBCIYt/8Xmb2C/6pxjQqlJb4Ebk1Y/Qheifk5ZF5EsqHTwz4EZ8ML7hthC/b9 X-Received: by 2002:a05:6a00:150f:b0:63f:1600:e711 with SMTP id q15-20020a056a00150f00b0063f1600e711mr18825564pfu.29.1682944941364; Mon, 01 May 2023 05:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682944941; cv=none; d=google.com; s=arc-20160816; b=DsAFQFpIymQAuViOyl5P0GPbOSNeSCtHe5a2iwijliujJ2THbYiFz4IBJu3ZyEZK0H arTbmyHFaT68NQBfW/hk5Yn/y4ibOzyK/40gdNrSR1XSLMYc+Ne/YUPAk+axcolaCoQJ fdHrQvJrCAXMKUkPtkGBBp4sWogKdrOc8JypEOqPLUThKz3o87CYT3WwYY9n2w3Nou6f aOE5J1Y6a6NMxE+dSbjbcs3oUzVT1yX61jVQ+NPN935C8i2+q7kBa12bYwSU/ehl4lJJ XidLJt5yH9wqicrS1o82RG4Ax6z/RHnRPUkPHYGygT2Y9Wj2zQmjsETWPTWJBhsNMdac sB8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=EUEJrGSU9dbvr4t0fqCm6zFszLF/bFGwTNtIbcqD6dc=; b=cbZkXogavQa1yCGaDShGwy49hk2OjXwpt35RfYenRr4Yy86M8iZ4yApnqnJ3ZVfSzG +X0//b3nGPM2Q0uZ6QXcgd9I6upkNQaYGyyQLrchwpQUDyHf/nZdwX/yOV4tshS92rn0 PT98fqa5+wpipewW0U/pqsdaT+OA1a29xwQMB/4qc7BzkcYhMJMCu+PhR1D/gxZJ33dI cPocyUamF6dG2rvDsbOhdMplXFn8QA3sq3uaodZhuE3gN4IANTOS903pkCuTmfQ6JmSq mDWyoTGu4OqmZ2biIsX+Ya9+q+7g0T41HL5I60mvosF/+99wSTtxDUqu83mgh7q+Vdns EhVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=nMsOv6yU; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e11-20020aa7980b000000b0063b68fa0803si28751494pfl.268.2023.05.01.05.42.08; Mon, 01 May 2023 05:42:21 -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; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=nMsOv6yU; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232370AbjEAMla (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Mon, 1 May 2023 08:41:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232334AbjEAMl3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 1 May 2023 08:41:29 -0400 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4361E43 for <linux-kernel@vger.kernel.org>; Mon, 1 May 2023 05:41:01 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id tSpZpM6hwpwRItSpZpInaY; Mon, 01 May 2023 14:40:40 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682944841; bh=EUEJrGSU9dbvr4t0fqCm6zFszLF/bFGwTNtIbcqD6dc=; h=From:To:Cc:Subject:Date; b=nMsOv6yUj20FO78qx7cQuyqhpBbMv1MDjFjIyx23VIP1d/rxsNuHlNzevfdXkRLn3 IvQPtzTfUBM8ikx6ycI5t6ZAOZKII//KTEfwXglID6qMJIWUJX26whoYTczGcOsiQp F+AxN4H0xgpoB4M3s2h1NAmSFaC9cMJlrF1guBP+XIzbAKaoEdzhybYsDW8sAyQaye 1j1upBoLJWU3kzWzhoNcM0JWTL4FmXdOK/5voGA+52uS5VBTxPG0Nb0iFKdNK7M0gf 1k4Xp2BnVmI58dVP6QZc18ZVec9T4PBpNBOMDUTkySsJCruKDYrsXfBepf0LLrS20X BdAq+togyimJg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 01 May 2023 14:40:40 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: hch@lst.de, sagi@grimberg.me, kch@nvidia.com Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr> Subject: [PATCH 0/5] optimize some data structure in nvme Date: Mon, 1 May 2023 14:40:24 +0200 Message-Id: <cover.1682941568.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764695674828545816?= X-GMAIL-MSGID: =?utf-8?q?1764695674828545816?= |
Series |
optimize some data structure in nvme
|
|
Message
Christophe JAILLET
May 1, 2023, 12:40 p.m. UTC
This serie is a proposal to slighly optimize the memory needed for some structures used in nvme. This follows the discussion in [1]. Honnestly, I'm not convinced that this serie really brings semething. Because of the way memory alocation works, and its over-allocation to try to avoid memory fragmentation, some limited gains are most of the time useless. It could still help: - many holes in structure can, at some point, have its size reach a threshold (this is specially true if such structures are allocated with kcalloc() or kmalloc_array()) - it can save some space in some other structures if embedded in them - it can save a few cycles if the structure is memcpy()'ed or zeroed, for example - can reduce cache usage With that in mind, patch 3 is a win, patch 4 is likely a win, the other ones are much more theorical. The changes are really limited, so even if the gain is marginal, maybe it still makes sense to merge them. Each patch gives the layout generated by pahole before and after the patch. [1]: https://lore.kernel.org/all/67a9e53e-4ac9-7ba8-9713-96c1dfe1e341@nvidia.com/ Christophe JAILLET (5): nvmet: Reorder fields in 'struct nvmet_sq' nvmet: Reorder fields in 'struct nvme_ctrl' nvmet: Reorder fields in 'struct nvmf_ctrl_options' nvmet: Reorder fields in 'struct nvme_dhchap_queue_context' nvmet: Reorder fields in 'struct nvmefc_fcp_req' drivers/nvme/host/auth.c | 6 +++--- drivers/nvme/host/fabrics.h | 8 ++++---- drivers/nvme/host/nvme.h | 6 +++--- drivers/nvme/target/nvmet.h | 4 ++-- include/linux/nvme-fc-driver.h | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-)
Comments
> This serie is a proposal to slighly optimize the memory needed for some > structures used in nvme. > > This follows the discussion in [1]. > > Honnestly, I'm not convinced that this serie really brings semething. > Because of the way memory alocation works, and its over-allocation to try to > avoid memory fragmentation, some limited gains are most of the time useless. > > It could still help: > - many holes in structure can, at some point, have its size reach a threshold > (this is specially true if such structures are allocated with kcalloc() or > kmalloc_array()) > - it can save some space in some other structures if embedded in them > - it can save a few cycles if the structure is memcpy()'ed or zeroed, for > example > - can reduce cache usage > > With that in mind, patch 3 is a win, patch 4 is likely a win, the other ones are > much more theorical. > > The changes are really limited, so even if the gain is marginal, maybe it still > makes sense to merge them. Don't see why not, given they make do the structures smaller. Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Thanks,
the whole series looks good to me:
Reviewed-by: Christoph Hellwig <hch@lst.de>
On 5/1/23 05:40, Christophe JAILLET wrote: > This serie is a proposal to slighly optimize the memory needed for some > structures used in nvme. > > This follows the discussion in [1]. > > Honnestly, I'm not convinced that this serie really brings semething. > Because of the way memory alocation works, and its over-allocation to try to > avoid memory fragmentation, some limited gains are most of the time useless. > > It could still help: > - many holes in structure can, at some point, have its size reach a threshold > (this is specially true if such structures are allocated with kcalloc() or > kmalloc_array()) > - it can save some space in some other structures if embedded in them > - it can save a few cycles if the structure is memcpy()'ed or zeroed, for > example > - can reduce cache usage > > With that in mind, patch 3 is a win, patch 4 is likely a win, the other ones are > much more theorical. > > The changes are really limited, so even if the gain is marginal, maybe it still > makes sense to merge them. > > Each patch gives the layout generated by pahole before and after the patch. > > [1]: https://lore.kernel.org/all/67a9e53e-4ac9-7ba8-9713-96c1dfe1e341@nvidia.com/ > > Christophe JAILLET (5): > nvmet: Reorder fields in 'struct nvmet_sq' > nvmet: Reorder fields in 'struct nvme_ctrl' > nvmet: Reorder fields in 'struct nvmf_ctrl_options' > nvmet: Reorder fields in 'struct nvme_dhchap_queue_context' > nvmet: Reorder fields in 'struct nvmefc_fcp_req' > > drivers/nvme/host/auth.c | 6 +++--- > drivers/nvme/host/fabrics.h | 8 ++++---- > drivers/nvme/host/nvme.h | 6 +++--- > drivers/nvme/target/nvmet.h | 4 ++-- > include/linux/nvme-fc-driver.h | 10 +++++----- > 5 files changed, 17 insertions(+), 17 deletions(-) > thanks a lot for doing this and following the comment on the other patch. Looks good. Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> -ck
Thanks, applied to nvme-6.5.