From patchwork Mon May 1 12:40:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 89044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2683986vqo; Mon, 1 May 2023 06:12:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5MT1UrupKe+IljvYwLBYb7WrB+qiouhrUiMMgxdrUJkqYu2dYgd/uUwY7j/IU9fOPkJVnp X-Received: by 2002:a17:90b:209:b0:24e:cb3:f7f8 with SMTP id fy9-20020a17090b020900b0024e0cb3f7f8mr2150137pjb.46.1682946737489; Mon, 01 May 2023 06:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682946737; cv=none; d=google.com; s=arc-20160816; b=NPds74z/HPDPkuNCVMCts0K05m+b/FLwabWBp6zyJhVRAxRG7gM7MuI2EyglWoorYH SoqHc+AWQ/44u46Pg6tMpqxPV3QoL8ANPR6Ktoc/4IRBkKLdKoaUhfJpi5NdqYVqw0YO ctJP29tAEzvdUFbmtcavTjniaqSduajlvINwTCqFkv+/oUlmipm9fkrZ6CKZjY6qXwOy F3ktwiER5P9/qGIS7GvPIz126L/fEy1NaiTz29W56mHFoXhIYkjqp3+Q2mx0dqh68z1B j8RYF5+yepJQv4vdRnlXErURmCU/Gj47XQ+WZ0tqQ8jOL/XyqfyHz72BuvCMOlA/hYai uKJA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QDh3dDPZUR9lwcq90WRl6vCV6llx9SiFdI20B6fyPHs=; b=AHe+OoksBIIJMFB+t6EKTAMrNLSkZdXSEtwoNjOSwz2Y/Og41Ah4Bvb4ZyDOwFG96p TIO5xMuJS0QGoPnWUrMH7DK+UihLoLQcFWIZ6c4AnqH4lrts8byxmj/cUskEaAMtZtm9 dPZo9fRuq2fNlcs49o1jC4LznbvyknbYaII6tqg3kSMr/DdwYZZNBACRy4XXerXNdAAL pYAiOioietsedtHYLUJqiKjRYKGXZwBf09iyDYPQGZ2n4P5s4Bh2EUMLa/GGF9VTVdf4 DrO51wURw0Tmwo+op+FHHTUHd3+iZ4fpBF8IphnZSUeD3DzQNNu7HPBoVnT52kestCXl YqPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=LMXMGduj; 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 kx18-20020a17090b229200b00242bface51csi8537675pjb.108.2023.05.01.06.11.48; Mon, 01 May 2023 06:12:17 -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=LMXMGduj; 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 S232487AbjEAMli (ORCPT + 99 others); Mon, 1 May 2023 08:41:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232540AbjEAMlf (ORCPT ); Mon, 1 May 2023 08:41:35 -0400 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA8C619A2 for ; Mon, 1 May 2023 05:41:06 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id tSpZpM6hwpwRItSphpInat; Mon, 01 May 2023 14:40:46 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682944846; bh=QDh3dDPZUR9lwcq90WRl6vCV6llx9SiFdI20B6fyPHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LMXMGdujWEzj0tnyZphahhdqBGzQr/fbX/JBdsW+3+ua2l3IopaC+8U7k4vgBcdMM XDVMlwba+gB+JVSj4TbiqF4Opi8TxRaMhRu/iE7Z1wP1/aSiQmdZ6AT9i9KkbWhHJX Z5kPhJJDiW78EMgrMhj1DWsvWk1paOG73+NUMV4nPbB49S7kTjlBTO/ZckEShOWt/D aJTnvwIbsNP+P00fCznQxoqzLk4qG9CrCU1XQL63pnGH3qZ2wer5vAYK6cCMwLJeRY SaJF071jLecexhzYRQmZTXHO9AbAmXBDy4o3Xh+Hxks8XNcx2UxMdRspphrAz54xRo YEI/gUH9xvO6g== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 01 May 2023 14:40:46 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET 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 Subject: [PATCH 1/5] nvmet: Reorder fields in 'struct nvmet_sq' Date: Mon, 1 May 2023 14:40:25 +0200 Message-Id: <2b87bc1e2168a79be02706411e874e9fce26d1e9.1682941568.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764697558193838779?= X-GMAIL-MSGID: =?utf-8?q?1764697558193838779?= Group some variables based on their sizes to reduce holes. On x86_64, this shrinks the size of 'struct nvmet_sq' from 472 to 464 bytes when CONFIG_NVME_TARGET_AUTH is defined. This structure is embedded into some other structures, so it helps reducing their sizes as well. Signed-off-by: Christophe JAILLET --- Using pahole Before: ====== struct nvmet_sq { struct nvmet_ctrl * ctrl; /* 0 8 */ struct percpu_ref ref; /* 8 16 */ u16 qid; /* 24 2 */ u16 size; /* 26 2 */ u32 sqhd; /* 28 4 */ bool sqhd_disabled; /* 32 1 */ /* XXX 7 bytes hole, try to pack */ struct delayed_work auth_expired_work; /* 40 184 */ /* XXX last struct has 4 bytes of padding */ /* --- cacheline 3 boundary (192 bytes) was 32 bytes ago --- */ bool authenticated; /* 224 1 */ /* XXX 1 byte hole, try to pack */ u16 dhchap_tid; /* 226 2 */ u16 dhchap_status; /* 228 2 */ /* XXX 2 bytes hole, try to pack */ int dhchap_step; /* 232 4 */ /* XXX 4 bytes hole, try to pack */ u8 * dhchap_c1; /* 240 8 */ u8 * dhchap_c2; /* 248 8 */ /* --- cacheline 4 boundary (256 bytes) --- */ u32 dhchap_s1; /* 256 4 */ u32 dhchap_s2; /* 260 4 */ u8 * dhchap_skey; /* 264 8 */ int dhchap_skey_len; /* 272 4 */ /* XXX 4 bytes hole, try to pack */ struct completion free_done; /* 280 96 */ /* --- cacheline 5 boundary (320 bytes) was 56 bytes ago --- */ struct completion confirm_done; /* 376 96 */ /* size: 472, cachelines: 8, members: 19 */ /* sum members: 454, holes: 5, sum holes: 18 */ /* paddings: 1, sum paddings: 4 */ /* last cacheline: 24 bytes */ }; After: ===== struct nvmet_sq { struct nvmet_ctrl * ctrl; /* 0 8 */ struct percpu_ref ref; /* 8 16 */ u16 qid; /* 24 2 */ u16 size; /* 26 2 */ u32 sqhd; /* 28 4 */ bool sqhd_disabled; /* 32 1 */ bool authenticated; /* 33 1 */ /* XXX 6 bytes hole, try to pack */ struct delayed_work auth_expired_work; /* 40 184 */ /* XXX last struct has 4 bytes of padding */ /* --- cacheline 3 boundary (192 bytes) was 32 bytes ago --- */ u16 dhchap_tid; /* 224 2 */ u16 dhchap_status; /* 226 2 */ int dhchap_step; /* 228 4 */ u8 * dhchap_c1; /* 232 8 */ u8 * dhchap_c2; /* 240 8 */ u32 dhchap_s1; /* 248 4 */ u32 dhchap_s2; /* 252 4 */ /* --- cacheline 4 boundary (256 bytes) --- */ u8 * dhchap_skey; /* 256 8 */ int dhchap_skey_len; /* 264 4 */ /* XXX 4 bytes hole, try to pack */ struct completion free_done; /* 272 96 */ /* --- cacheline 5 boundary (320 bytes) was 48 bytes ago --- */ struct completion confirm_done; /* 368 96 */ /* size: 464, cachelines: 8, members: 19 */ /* sum members: 454, holes: 2, sum holes: 10 */ /* paddings: 1, sum paddings: 4 */ /* last cacheline: 16 bytes */ }; --- drivers/nvme/target/nvmet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index c50146085fb5..8cfd60f3b564 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h @@ -109,8 +109,8 @@ struct nvmet_sq { u32 sqhd; bool sqhd_disabled; #ifdef CONFIG_NVME_TARGET_AUTH - struct delayed_work auth_expired_work; bool authenticated; + struct delayed_work auth_expired_work; u16 dhchap_tid; u16 dhchap_status; int dhchap_step; From patchwork Mon May 1 12:40:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 89033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2665229vqo; Mon, 1 May 2023 05:42:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4iIryJcns2JsojOu7DWOkHjhll166Y587Jfny8wLo9bNga8Gm9j/aNAh9sM9KSrVPFvkK9 X-Received: by 2002:a17:902:c94d:b0:1a9:6d25:b2d2 with SMTP id i13-20020a170902c94d00b001a96d25b2d2mr16004457pla.67.1682944961015; Mon, 01 May 2023 05:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682944961; cv=none; d=google.com; s=arc-20160816; b=ZKj/97aVc9fBUcDsHyT8aPEla4NUmlIR7c6az96BiZEOXzE7gIDySNaDnhU08Z7+CO 1pSeqHRt5495B/gIOeDjyaF79ih2zdGPvncISQ2TZOYJpztcYhRb0vdgyy360u1PSQG1 FmnNvKaJx2meEiwBUzFTOFG2Ja/j4OwMeie/xVsD1EqdRyY3J9RqdkMBSanFAjVhTKLc DoPKgw9tegMhBFMS4aCOTjAOcbS1xQJ0suOxYiGqW6Nsa0T/80QuqkMqFdrZ+0GxQraB 6Jpb5yqA9YPELDTqHtgyR0HSF5NcY8gvPj8fSb/CblDfwEoZw0m2++E9oFld3bhdtV+0 Levw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Y6jX0UsDm6a3lp5CHJtUMkKwAUFLiSnErUnf1hMH8N8=; b=RDTZ/4g0W+22ys4wiQa3vcRbqrVx0gSzo5KoP6euECYvGvO3jpHM/TBbTNeEo8rIrR OaCogKA3sEqKmNtMZVG+btQyDWK/X5RIb8GHRp6Rhj63FmiYETGpfdFH47OZat+oxRw6 eAlTBasB4Z2zuJcYY58bqdASDopZEPECYu4wxiDSmPXBccUj9gZl2fZ5n9YY0uhC9Y5T bxeIjElm4lol1/B8bpksfW0tFGb8nJjjn2yEnv2KPn50Sc0IN7TM782IZ9hdaWY1IQcD vIMFP1CFDyzoHPdDkqfyugEIqLqkTlp5E+UP0Yk94NpP3Eid8pqNY6nx6yhokDlrEgWf PMuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=EFN9WBZZ; 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 ik4-20020a170902ab0400b001aaf6228a75si2205258plb.88.2023.05.01.05.42.28; Mon, 01 May 2023 05:42: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; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=EFN9WBZZ; 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 S232556AbjEAMlp (ORCPT + 99 others); Mon, 1 May 2023 08:41:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232540AbjEAMlo (ORCPT ); Mon, 1 May 2023 08:41:44 -0400 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74323E52 for ; Mon, 1 May 2023 05:41:09 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id tSpZpM6hwpwRItSpjpInb1; Mon, 01 May 2023 14:40:47 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682944847; bh=Y6jX0UsDm6a3lp5CHJtUMkKwAUFLiSnErUnf1hMH8N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EFN9WBZZ4HzqtmJmr+PAeusz/dEKjcn+ji/X+woIXvyf7jxlPZeY3IZiGi0zpxhVI yemqCzluDCowJFRfckb+4etAHcmFnWVN37j/iVSyBI/1LF3RnHBFrqVysUDdS6MNOY yviiQNl6t388hJf7MKyfxl9gsfqrH55CtVVF1RP0eq6fbKb84wy68E8NB78rjJhX45 hXx2SboRQISzSUZxwnRgsJKd1RpnSLDJxmpjC0qDopVoV4/oOZw54X4c7bcPW/S1ar DxR7/gdcC9QboizEPICbCc/IEgtTl/J5YSuxlsC48vMVha8ukh8J0jBdGZpOIuDzOX ihpWYzUu01tgw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 01 May 2023 14:40:47 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET 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 Subject: [PATCH 2/5] nvmet: Reorder fields in 'struct nvme_ctrl' Date: Mon, 1 May 2023 14:40:26 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 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=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764695695197626621?= X-GMAIL-MSGID: =?utf-8?q?1764695695197626621?= Group some variables based on their sizes to reduce holes. On x86_64, this shrinks the size of 'struct nvmet_sq' from 5368 to 5344 bytes when all CONFIG_* are defined. This structure is embedded into some other structures, so it helps reducing their size as well. Signed-off-by: Christophe JAILLET --- Using pahole Before: ====== struct nvme_ctrl { bool comp_seen; /* 0 1 */ /* XXX 3 bytes hole, try to pack */ enum nvme_ctrl_state state; /* 4 4 */ bool identified; /* 8 1 */ /* XXX 7 bytes hole, try to pack */ spinlock_t lock; /* 16 72 */ /* --- cacheline 1 boundary (64 bytes) was 24 bytes ago --- */ struct mutex scan_lock; /* 88 160 */ /* --- cacheline 3 boundary (192 bytes) was 56 bytes ago --- */ const struct nvme_ctrl_ops * ops; /* 248 8 */ /* --- cacheline 4 boundary (256 bytes) --- */ struct request_queue * admin_q; /* 256 8 */ struct request_queue * connect_q; /* 264 8 */ struct request_queue * fabrics_q; /* 272 8 */ struct device * dev; /* 280 8 */ int instance; /* 288 4 */ int numa_node; /* 292 4 */ struct blk_mq_tag_set * tagset; /* 296 8 */ struct blk_mq_tag_set * admin_tagset; /* 304 8 */ struct list_head namespaces; /* 312 16 */ /* --- cacheline 5 boundary (320 bytes) was 8 bytes ago --- */ struct rw_semaphore namespaces_rwsem; /* 328 168 */ /* --- cacheline 7 boundary (448 bytes) was 48 bytes ago --- */ struct device ctrl_device __attribute__((__aligned__(8))); /* 496 1400 */ /* XXX last struct has 3 bytes of padding */ /* --- cacheline 29 boundary (1856 bytes) was 40 bytes ago --- */ struct device * device; /* 1896 8 */ struct device * hwmon_device; /* 1904 8 */ struct cdev cdev; /* 1912 296 */ /* --- cacheline 34 boundary (2176 bytes) was 32 bytes ago --- */ struct work_struct reset_work; /* 2208 80 */ /* --- cacheline 35 boundary (2240 bytes) was 48 bytes ago --- */ struct work_struct delete_work; /* 2288 80 */ /* --- cacheline 37 boundary (2368 bytes) --- */ wait_queue_head_t state_wq; /* 2368 88 */ /* --- cacheline 38 boundary (2432 bytes) was 24 bytes ago --- */ struct nvme_subsystem * subsys; /* 2456 8 */ struct list_head subsys_entry; /* 2464 16 */ struct opal_dev * opal_dev; /* 2480 8 */ char name[12]; /* 2488 12 */ /* --- cacheline 39 boundary (2496 bytes) was 4 bytes ago --- */ u16 cntlid; /* 2500 2 */ /* XXX 2 bytes hole, try to pack */ u32 ctrl_config; /* 2504 4 */ u16 mtfa; /* 2508 2 */ /* XXX 2 bytes hole, try to pack */ u32 queue_count; /* 2512 4 */ /* XXX 4 bytes hole, try to pack */ u64 cap; /* 2520 8 */ u32 max_hw_sectors; /* 2528 4 */ u32 max_segments; /* 2532 4 */ u32 max_integrity_segments; /* 2536 4 */ u32 max_discard_sectors; /* 2540 4 */ u32 max_discard_segments; /* 2544 4 */ u32 max_zeroes_sectors; /* 2548 4 */ u32 max_zone_append; /* 2552 4 */ u16 crdt[3]; /* 2556 6 */ /* --- cacheline 40 boundary (2560 bytes) was 2 bytes ago --- */ u16 oncs; /* 2562 2 */ u32 dmrsl; /* 2564 4 */ u16 oacs; /* 2568 2 */ u16 sqsize; /* 2570 2 */ u32 max_namespaces; /* 2572 4 */ atomic_t abort_limit; /* 2576 4 */ u8 vwc; /* 2580 1 */ /* XXX 3 bytes hole, try to pack */ u32 vs; /* 2584 4 */ u32 sgls; /* 2588 4 */ u16 kas; /* 2592 2 */ u8 npss; /* 2594 1 */ u8 apsta; /* 2595 1 */ u16 wctemp; /* 2596 2 */ u16 cctemp; /* 2598 2 */ u32 oaes; /* 2600 4 */ u32 aen_result; /* 2604 4 */ u32 ctratt; /* 2608 4 */ unsigned int shutdown_timeout; /* 2612 4 */ unsigned int kato; /* 2616 4 */ bool subsystem; /* 2620 1 */ /* XXX 3 bytes hole, try to pack */ /* --- cacheline 41 boundary (2624 bytes) --- */ long unsigned int quirks; /* 2624 8 */ struct nvme_id_power_state psd[32]; /* 2632 1024 */ /* --- cacheline 57 boundary (3648 bytes) was 8 bytes ago --- */ struct nvme_effects_log * effects; /* 3656 8 */ struct xarray cels; /* 3664 88 */ /* --- cacheline 58 boundary (3712 bytes) was 40 bytes ago --- */ struct work_struct scan_work; /* 3752 80 */ /* --- cacheline 59 boundary (3776 bytes) was 56 bytes ago --- */ struct work_struct async_event_work; /* 3832 80 */ /* --- cacheline 61 boundary (3904 bytes) was 8 bytes ago --- */ struct delayed_work ka_work; /* 3912 184 */ /* XXX last struct has 4 bytes of padding */ /* --- cacheline 64 boundary (4096 bytes) --- */ struct delayed_work failfast_work; /* 4096 184 */ /* XXX last struct has 4 bytes of padding */ /* --- cacheline 66 boundary (4224 bytes) was 56 bytes ago --- */ struct nvme_command ka_cmd; /* 4280 64 */ /* --- cacheline 67 boundary (4288 bytes) was 56 bytes ago --- */ struct work_struct fw_act_work; /* 4344 80 */ /* --- cacheline 69 boundary (4416 bytes) was 8 bytes ago --- */ long unsigned int events; /* 4424 8 */ u8 anacap; /* 4432 1 */ u8 anatt; /* 4433 1 */ /* XXX 2 bytes hole, try to pack */ u32 anagrpmax; /* 4436 4 */ u32 nanagrpid; /* 4440 4 */ /* XXX 4 bytes hole, try to pack */ struct mutex ana_lock; /* 4448 160 */ /* --- cacheline 72 boundary (4608 bytes) --- */ struct nvme_ana_rsp_hdr * ana_log_buf; /* 4608 8 */ size_t ana_log_size; /* 4616 8 */ struct timer_list anatt_timer; /* 4624 88 */ /* --- cacheline 73 boundary (4672 bytes) was 40 bytes ago --- */ struct work_struct ana_work; /* 4712 80 */ /* --- cacheline 74 boundary (4736 bytes) was 56 bytes ago --- */ struct work_struct dhchap_auth_work; /* 4792 80 */ /* --- cacheline 76 boundary (4864 bytes) was 8 bytes ago --- */ struct mutex dhchap_auth_mutex; /* 4872 160 */ /* --- cacheline 78 boundary (4992 bytes) was 40 bytes ago --- */ struct nvme_dhchap_queue_context * dhchap_ctxs; /* 5032 8 */ struct nvme_dhchap_key * host_key; /* 5040 8 */ struct nvme_dhchap_key * ctrl_key; /* 5048 8 */ /* --- cacheline 79 boundary (5056 bytes) --- */ u16 transaction; /* 5056 2 */ /* XXX 6 bytes hole, try to pack */ u64 ps_max_latency_us; /* 5064 8 */ bool apst_enabled; /* 5072 1 */ /* XXX 3 bytes hole, try to pack */ u32 hmpre; /* 5076 4 */ u32 hmmin; /* 5080 4 */ u32 hmminds; /* 5084 4 */ u16 hmmaxd; /* 5088 2 */ /* XXX 2 bytes hole, try to pack */ u32 ioccsz; /* 5092 4 */ u32 iorcsz; /* 5096 4 */ u16 icdoff; /* 5100 2 */ u16 maxcmd; /* 5102 2 */ int nr_reconnects; /* 5104 4 */ /* XXX 4 bytes hole, try to pack */ long unsigned int flags; /* 5112 8 */ /* --- cacheline 80 boundary (5120 bytes) --- */ struct nvmf_ctrl_options * opts; /* 5120 8 */ struct page * discard_page; /* 5128 8 */ long unsigned int discard_page_busy; /* 5136 8 */ struct nvme_fault_inject fault_inject; /* 5144 216 */ /* XXX last struct has 4 bytes of padding */ /* --- cacheline 83 boundary (5312 bytes) was 48 bytes ago --- */ enum nvme_ctrl_type cntrltype; /* 5360 4 */ enum nvme_dctype dctype; /* 5364 4 */ /* size: 5368, cachelines: 84, members: 104 */ /* sum members: 5323, holes: 13, sum holes: 45 */ /* paddings: 4, sum paddings: 15 */ /* forced alignments: 1 */ /* last cacheline: 56 bytes */ } __attribute__((__aligned__(8))); After: ===== struct nvme_ctrl { bool comp_seen; /* 0 1 */ bool identified; /* 1 1 */ /* XXX 2 bytes hole, try to pack */ enum nvme_ctrl_state state; /* 4 4 */ spinlock_t lock; /* 8 72 */ /* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */ struct mutex scan_lock; /* 80 160 */ /* --- cacheline 3 boundary (192 bytes) was 48 bytes ago --- */ const struct nvme_ctrl_ops * ops; /* 240 8 */ struct request_queue * admin_q; /* 248 8 */ /* --- cacheline 4 boundary (256 bytes) --- */ struct request_queue * connect_q; /* 256 8 */ struct request_queue * fabrics_q; /* 264 8 */ struct device * dev; /* 272 8 */ int instance; /* 280 4 */ int numa_node; /* 284 4 */ struct blk_mq_tag_set * tagset; /* 288 8 */ struct blk_mq_tag_set * admin_tagset; /* 296 8 */ struct list_head namespaces; /* 304 16 */ /* --- cacheline 5 boundary (320 bytes) --- */ struct rw_semaphore namespaces_rwsem; /* 320 168 */ /* --- cacheline 7 boundary (448 bytes) was 40 bytes ago --- */ struct device ctrl_device __attribute__((__aligned__(8))); /* 488 1400 */ /* XXX last struct has 3 bytes of padding */ /* --- cacheline 29 boundary (1856 bytes) was 32 bytes ago --- */ struct device * device; /* 1888 8 */ struct device * hwmon_device; /* 1896 8 */ struct cdev cdev; /* 1904 296 */ /* --- cacheline 34 boundary (2176 bytes) was 24 bytes ago --- */ struct work_struct reset_work; /* 2200 80 */ /* --- cacheline 35 boundary (2240 bytes) was 40 bytes ago --- */ struct work_struct delete_work; /* 2280 80 */ /* --- cacheline 36 boundary (2304 bytes) was 56 bytes ago --- */ wait_queue_head_t state_wq; /* 2360 88 */ /* --- cacheline 38 boundary (2432 bytes) was 16 bytes ago --- */ struct nvme_subsystem * subsys; /* 2448 8 */ struct list_head subsys_entry; /* 2456 16 */ struct opal_dev * opal_dev; /* 2472 8 */ char name[12]; /* 2480 12 */ u16 cntlid; /* 2492 2 */ u16 mtfa; /* 2494 2 */ /* --- cacheline 39 boundary (2496 bytes) --- */ u32 ctrl_config; /* 2496 4 */ u32 queue_count; /* 2500 4 */ u64 cap; /* 2504 8 */ u32 max_hw_sectors; /* 2512 4 */ u32 max_segments; /* 2516 4 */ u32 max_integrity_segments; /* 2520 4 */ u32 max_discard_sectors; /* 2524 4 */ u32 max_discard_segments; /* 2528 4 */ u32 max_zeroes_sectors; /* 2532 4 */ u32 max_zone_append; /* 2536 4 */ u16 crdt[3]; /* 2540 6 */ u16 oncs; /* 2546 2 */ u32 dmrsl; /* 2548 4 */ u16 oacs; /* 2552 2 */ u16 sqsize; /* 2554 2 */ u32 max_namespaces; /* 2556 4 */ /* --- cacheline 40 boundary (2560 bytes) --- */ atomic_t abort_limit; /* 2560 4 */ u8 vwc; /* 2564 1 */ /* XXX 3 bytes hole, try to pack */ u32 vs; /* 2568 4 */ u32 sgls; /* 2572 4 */ u16 kas; /* 2576 2 */ u8 npss; /* 2578 1 */ u8 apsta; /* 2579 1 */ u16 wctemp; /* 2580 2 */ u16 cctemp; /* 2582 2 */ u32 oaes; /* 2584 4 */ u32 aen_result; /* 2588 4 */ u32 ctratt; /* 2592 4 */ unsigned int shutdown_timeout; /* 2596 4 */ unsigned int kato; /* 2600 4 */ bool subsystem; /* 2604 1 */ /* XXX 3 bytes hole, try to pack */ long unsigned int quirks; /* 2608 8 */ struct nvme_id_power_state psd[32]; /* 2616 1024 */ /* --- cacheline 56 boundary (3584 bytes) was 56 bytes ago --- */ struct nvme_effects_log * effects; /* 3640 8 */ /* --- cacheline 57 boundary (3648 bytes) --- */ struct xarray cels; /* 3648 88 */ /* --- cacheline 58 boundary (3712 bytes) was 24 bytes ago --- */ struct work_struct scan_work; /* 3736 80 */ /* --- cacheline 59 boundary (3776 bytes) was 40 bytes ago --- */ struct work_struct async_event_work; /* 3816 80 */ /* --- cacheline 60 boundary (3840 bytes) was 56 bytes ago --- */ struct delayed_work ka_work; /* 3896 184 */ /* XXX last struct has 4 bytes of padding */ /* --- cacheline 63 boundary (4032 bytes) was 48 bytes ago --- */ struct delayed_work failfast_work; /* 4080 184 */ /* XXX last struct has 4 bytes of padding */ /* --- cacheline 66 boundary (4224 bytes) was 40 bytes ago --- */ struct nvme_command ka_cmd; /* 4264 64 */ /* --- cacheline 67 boundary (4288 bytes) was 40 bytes ago --- */ struct work_struct fw_act_work; /* 4328 80 */ /* --- cacheline 68 boundary (4352 bytes) was 56 bytes ago --- */ long unsigned int events; /* 4408 8 */ /* --- cacheline 69 boundary (4416 bytes) --- */ u8 anacap; /* 4416 1 */ u8 anatt; /* 4417 1 */ /* XXX 2 bytes hole, try to pack */ u32 anagrpmax; /* 4420 4 */ u32 nanagrpid; /* 4424 4 */ /* XXX 4 bytes hole, try to pack */ struct mutex ana_lock; /* 4432 160 */ /* --- cacheline 71 boundary (4544 bytes) was 48 bytes ago --- */ struct nvme_ana_rsp_hdr * ana_log_buf; /* 4592 8 */ size_t ana_log_size; /* 4600 8 */ /* --- cacheline 72 boundary (4608 bytes) --- */ struct timer_list anatt_timer; /* 4608 88 */ /* --- cacheline 73 boundary (4672 bytes) was 24 bytes ago --- */ struct work_struct ana_work; /* 4696 80 */ /* --- cacheline 74 boundary (4736 bytes) was 40 bytes ago --- */ struct work_struct dhchap_auth_work; /* 4776 80 */ /* --- cacheline 75 boundary (4800 bytes) was 56 bytes ago --- */ struct mutex dhchap_auth_mutex; /* 4856 160 */ /* --- cacheline 78 boundary (4992 bytes) was 24 bytes ago --- */ struct nvme_dhchap_queue_context * dhchap_ctxs; /* 5016 8 */ struct nvme_dhchap_key * host_key; /* 5024 8 */ struct nvme_dhchap_key * ctrl_key; /* 5032 8 */ u16 transaction; /* 5040 2 */ /* XXX 6 bytes hole, try to pack */ u64 ps_max_latency_us; /* 5048 8 */ /* --- cacheline 79 boundary (5056 bytes) --- */ bool apst_enabled; /* 5056 1 */ /* XXX 1 byte hole, try to pack */ u16 hmmaxd; /* 5058 2 */ u32 hmpre; /* 5060 4 */ u32 hmmin; /* 5064 4 */ u32 hmminds; /* 5068 4 */ u32 ioccsz; /* 5072 4 */ u32 iorcsz; /* 5076 4 */ u16 icdoff; /* 5080 2 */ u16 maxcmd; /* 5082 2 */ int nr_reconnects; /* 5084 4 */ long unsigned int flags; /* 5088 8 */ struct nvmf_ctrl_options * opts; /* 5096 8 */ struct page * discard_page; /* 5104 8 */ long unsigned int discard_page_busy; /* 5112 8 */ /* --- cacheline 80 boundary (5120 bytes) --- */ struct nvme_fault_inject fault_inject; /* 5120 216 */ /* XXX last struct has 4 bytes of padding */ /* --- cacheline 83 boundary (5312 bytes) was 24 bytes ago --- */ enum nvme_ctrl_type cntrltype; /* 5336 4 */ enum nvme_dctype dctype; /* 5340 4 */ /* size: 5344, cachelines: 84, members: 104 */ /* sum members: 5323, holes: 7, sum holes: 21 */ /* paddings: 4, sum paddings: 15 */ /* forced alignments: 1 */ /* last cacheline: 32 bytes */ } __attribute__((__aligned__(8))); --- drivers/nvme/host/nvme.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index bf46f122e9e1..53417b6439a7 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -246,8 +246,8 @@ enum nvme_ctrl_flags { struct nvme_ctrl { bool comp_seen; - enum nvme_ctrl_state state; bool identified; + enum nvme_ctrl_state state; spinlock_t lock; struct mutex scan_lock; const struct nvme_ctrl_ops *ops; @@ -279,8 +279,8 @@ struct nvme_ctrl { char name[12]; u16 cntlid; - u32 ctrl_config; u16 mtfa; + u32 ctrl_config; u32 queue_count; u64 cap; @@ -353,10 +353,10 @@ struct nvme_ctrl { bool apst_enabled; /* PCIe only: */ + u16 hmmaxd; u32 hmpre; u32 hmmin; u32 hmminds; - u16 hmmaxd; /* Fabrics only */ u32 ioccsz; From patchwork Mon May 1 12:40:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 89040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2671777vqo; Mon, 1 May 2023 05:55:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4b1ZGiXQSCPn5Kic32hdHmOEBqgeZes8sGT7dnC1dBQM+PoU+xrG/dys2mf8StHMOmzrqV X-Received: by 2002:a17:902:ceca:b0:1a9:581d:3efb with SMTP id d10-20020a170902ceca00b001a9581d3efbmr16934543plg.6.1682945745561; Mon, 01 May 2023 05:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682945745; cv=none; d=google.com; s=arc-20160816; b=S/D2qs4QaritGvNpmBc3VyxuP87Zg8KodxlcVKq1MzZ6AjMC/7NJU8MPd4T9GOWAzm Jf/oBSgX3/5OkD3ImpOnI5j7Xdhfvu0b7WdLlyH9RCcmERxk4HFySXV4iQcrNd8gpUVh aGYXvSyfewlYa6OSWl1vCzlBuT4MI4PKBXFohy+QRu1GUTl7w4xeIyFaFfSGdhpr5Qlr q45IigR0iU/HxBcd5VMxi4XYkVyZGwfxsX/Y+i8nd0579GVkSHZ7JE5bwWVpYfULSdLR g+XW2kpg66iSi1KU/XDPvR4bgER3tL8g21cGgOHoCaosOQakDdaFq4/EsjHira2lZK04 Sl8g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C43rYffzeLeuYm1ltXsP0tciLDt8iNhANcYULlPeETQ=; b=UQpyBVaj6qcIF+Y70T+XC3x+pf/j+kQtRdfaGkipfduB0W+zysLIIYN4LqZdshbDbF xjJiZT/Sf/DCJtTrgAP49eDOytzyXObxtWG/HqtPd6kyjoSLkYA/KC/L6qoxhjaDL5+R xM1QC0f1YcMHOJcswHmuXLXJ6k166lJXsLMcf1HHCdv8G0kuEY+NCCHDo060MxTeTVZ2 5y0aCdUBTPFt+LqK8JJPhmU14rqHmedpFnw06lpLzyx4+Ozp5gydUuQ6mpT4hflJ5SeX emQ8xMxmYVW/buHi5X93V/g96wQ36iSau2l6JZhwBfVfT2Evu9WPJIKeefAgsgRirDd0 seVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=HQrssG6w; 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 t10-20020a170902e84a00b0019a826d3054si29286722plg.640.2023.05.01.05.55.30; Mon, 01 May 2023 05:55: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; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=HQrssG6w; 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 S232540AbjEAMlq (ORCPT + 99 others); Mon, 1 May 2023 08:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232573AbjEAMlp (ORCPT ); Mon, 1 May 2023 08:41:45 -0400 Received: from smtp.smtpout.orange.fr (smtp-26.smtpout.orange.fr [80.12.242.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 751CC1716 for ; Mon, 1 May 2023 05:41:10 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id tSpZpM6hwpwRItSpkpInb8; Mon, 01 May 2023 14:40:48 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682944848; bh=C43rYffzeLeuYm1ltXsP0tciLDt8iNhANcYULlPeETQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HQrssG6wByiAUvHE7mEaJaHjVvUhQyZjXSRSr4ruDx1SRpgEeS8XnMp4o3mQtwDFB KBfkH5y4ndSsmdjLjCbZsmYtbNSo92JROIcT3t1JDN/lzbvQC8E5vKYIDcVFWWY8Iw PoVzohoIiYtWqWty3vNTklmwKjjQ8az2XcWOko1YmtnGhnm1DK9MpkZNY03oeSOcxw EXEDzNN6NLRG1TPmP7dgPyi+IepdqHula80oVmG46HUajJ9HxmWhicjgBE84/UfgI0 87Lp0fqqmz1Jg+vL1H3Ro9U+9Oxr/51Xi1nBJu0mDvC4fT3RnDIDETcmx9R+i+PoK6 IWRKvy1z4HYzw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 01 May 2023 14:40:48 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET 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 Subject: [PATCH 3/5] nvmet: Reorder fields in 'struct nvmf_ctrl_options' Date: Mon, 1 May 2023 14:40:27 +0200 Message-Id: <78d06714ee7db7d977c390514b3bcfc71a07916f.1682941568.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764696517962430994?= X-GMAIL-MSGID: =?utf-8?q?1764696517962430994?= Group some variables based on their sizes to reduce holes. On x86_64, this shrinks the size of 'struct nvmf_ctrl_options' from 136 to 128 bytes. When such a structure is allocated in nvmf_create_ctrl(), because of the way memory allocation works, when 136 bytes were requested, 192 bytes were allocated. So this saves 64 bytes per allocation, 1 cache line to hold the whole structure and a few cycles when zeroing the memory in nvmf_create_ctrl(). Signed-off-by: Christophe JAILLET --- Using pahole Before: ====== struct nvmf_ctrl_options { unsigned int mask; /* 0 4 */ /* XXX 4 bytes hole, try to pack */ char * transport; /* 8 8 */ char * subsysnqn; /* 16 8 */ char * traddr; /* 24 8 */ char * trsvcid; /* 32 8 */ char * host_traddr; /* 40 8 */ char * host_iface; /* 48 8 */ size_t queue_size; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ unsigned int nr_io_queues; /* 64 4 */ unsigned int reconnect_delay; /* 68 4 */ bool discovery_nqn; /* 72 1 */ bool duplicate_connect; /* 73 1 */ /* XXX 2 bytes hole, try to pack */ unsigned int kato; /* 76 4 */ struct nvmf_host * host; /* 80 8 */ int max_reconnects; /* 88 4 */ /* XXX 4 bytes hole, try to pack */ char * dhchap_secret; /* 96 8 */ char * dhchap_ctrl_secret; /* 104 8 */ bool disable_sqflow; /* 112 1 */ bool hdr_digest; /* 113 1 */ bool data_digest; /* 114 1 */ /* XXX 1 byte hole, try to pack */ unsigned int nr_write_queues; /* 116 4 */ unsigned int nr_poll_queues; /* 120 4 */ int tos; /* 124 4 */ /* --- cacheline 2 boundary (128 bytes) --- */ int fast_io_fail_tmo; /* 128 4 */ /* size: 136, cachelines: 3, members: 24 */ /* sum members: 121, holes: 4, sum holes: 11 */ /* padding: 4 */ /* last cacheline: 8 bytes */ }; After: ===== struct nvmf_ctrl_options { unsigned int mask; /* 0 4 */ int max_reconnects; /* 4 4 */ char * transport; /* 8 8 */ char * subsysnqn; /* 16 8 */ char * traddr; /* 24 8 */ char * trsvcid; /* 32 8 */ char * host_traddr; /* 40 8 */ char * host_iface; /* 48 8 */ size_t queue_size; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ unsigned int nr_io_queues; /* 64 4 */ unsigned int reconnect_delay; /* 68 4 */ bool discovery_nqn; /* 72 1 */ bool duplicate_connect; /* 73 1 */ /* XXX 2 bytes hole, try to pack */ unsigned int kato; /* 76 4 */ struct nvmf_host * host; /* 80 8 */ char * dhchap_secret; /* 88 8 */ char * dhchap_ctrl_secret; /* 96 8 */ bool disable_sqflow; /* 104 1 */ bool hdr_digest; /* 105 1 */ bool data_digest; /* 106 1 */ /* XXX 1 byte hole, try to pack */ unsigned int nr_write_queues; /* 108 4 */ unsigned int nr_poll_queues; /* 112 4 */ int tos; /* 116 4 */ int fast_io_fail_tmo; /* 120 4 */ /* size: 128, cachelines: 2, members: 24 */ /* sum members: 121, holes: 2, sum holes: 3 */ /* padding: 4 */ }; --- drivers/nvme/host/fabrics.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h index dcac3df8a5f7..1bc57fb75825 100644 --- a/drivers/nvme/host/fabrics.h +++ b/drivers/nvme/host/fabrics.h @@ -77,6 +77,9 @@ enum { * with the parsing opts enum. * @mask: Used by the fabrics library to parse through sysfs options * on adding a NVMe controller. + * @max_reconnects: maximum number of allowed reconnect attempts before removing + * the controller, (-1) means reconnect forever, zero means remove + * immediately; * @transport: Holds the fabric transport "technology name" (for a lack of * better description) that will be used by an NVMe controller * being added. @@ -96,9 +99,6 @@ enum { * @discovery_nqn: indicates if the subsysnqn is the well-known discovery NQN. * @kato: Keep-alive timeout. * @host: Virtual NVMe host, contains the NQN and Host ID. - * @max_reconnects: maximum number of allowed reconnect attempts before removing - * the controller, (-1) means reconnect forever, zero means remove - * immediately; * @dhchap_secret: DH-HMAC-CHAP secret * @dhchap_ctrl_secret: DH-HMAC-CHAP controller secret for bi-directional * authentication @@ -112,6 +112,7 @@ enum { */ struct nvmf_ctrl_options { unsigned mask; + int max_reconnects; char *transport; char *subsysnqn; char *traddr; @@ -125,7 +126,6 @@ struct nvmf_ctrl_options { bool duplicate_connect; unsigned int kato; struct nvmf_host *host; - int max_reconnects; char *dhchap_secret; char *dhchap_ctrl_secret; bool disable_sqflow; From patchwork Mon May 1 12:40:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 89039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2669834vqo; Mon, 1 May 2023 05:51:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6i7Si9PZlKYPnJtzT9i3W66nsuHhPVcRyNTdFAPzcmCVE3ay/zmfSts4s6CGxzGtKoKJQt X-Received: by 2002:a05:6a00:168b:b0:63b:5496:7afa with SMTP id k11-20020a056a00168b00b0063b54967afamr19963238pfc.11.1682945497279; Mon, 01 May 2023 05:51:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682945497; cv=none; d=google.com; s=arc-20160816; b=I0+c83g2sENmVQca68vJlAXbL6BtYTnX5Cr9gA0FV2jRm/AZoHx8cuOtFFHHDnDAET kj3VTEWtzX0UjPwWmygqHwLCOG83vUWS0mdpmruKIGKWZ8Zy3wcC+XuwCsj5STXZqaZG aCjHnKnuQZJAM2+zy5womWDmsaRMVueGk0hNI1bCYD+yKIajXXFyaEvhIdGQzdb2Url/ OuSyQoaCHa0Ey7tNlI3bPFme5ivYJvMpb7MC2B/Zll0zZENaaF31404mV9CI4x+EFS2f 9Jc4wM8l8yATU8Jpmkw+Twb8ScwF9e37KQy1/C6euZ8lvJMR80IZYkZRPpCN8K33e8Yi fbeQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EHhwOOQJhYG1zhAhvZ6TNtxRY+Z65siR69ZTkVbLHsk=; b=UqEW0FBVzSh2e5luNoKPM3WMm7zCQpg9X79uxdfK8fwiVoYHzPli0yu5UzEliCSvef AhM963f2hp+ZGYi1NsqDBsYRjdfkcw00DyHZJrRbZQwXYLW0/vMSRFcwRn2jR6/7V9Y0 RmhBXiL1kTJQPcJ3+e1FcqYl27gi9YxDxNyzx5r/rne3ycl6hyKz9n9mU4AanGVefeWa KqVQlEeODte//gkPC1e3mkdBazmjyymSOftPaLrJrXo5Ayi3H6rj/CtrrW78h8D8PFFQ jbgvd1jithTI+WAFHonJfHX4OE2ooSuVKpY2yFvMqsAXGuSX9E6918pzZ8WhdzpBvp99 KdNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=I8VtBR0K; 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 b2-20020a656682000000b0051367d909efsi24308019pgw.106.2023.05.01.05.51.22; Mon, 01 May 2023 05:51:37 -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=I8VtBR0K; 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 S232613AbjEAMlz (ORCPT + 99 others); Mon, 1 May 2023 08:41:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232602AbjEAMls (ORCPT ); Mon, 1 May 2023 08:41:48 -0400 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE92A10FF for ; Mon, 1 May 2023 05:41:13 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id tSpZpM6hwpwRItSplpInbJ; Mon, 01 May 2023 14:40:49 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682944849; bh=EHhwOOQJhYG1zhAhvZ6TNtxRY+Z65siR69ZTkVbLHsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=I8VtBR0KIkrJ450/GNdjOJGydw0hy4+xO//IkaI1yGpXbnf3Tovs0FaycrPclQVBI Mcj/QX4e2oQwrnLtNZmgRtP2IfUpq4SZukQvd1zR8+uqWaRmy9ktr/n02SaBnf9VIO WAqCN8Kpm97D/BtiSkfSdDbnwb/6GwquDKI7oREPAUSFkSKUT7VEcom3dB2LMvTl3K R2xRIO+dBG8xlk6G/KW1YoBKABK2sQBVxl/xJZPdEh1allWpmA4y7OglEMcGP0bKjw Cgi027/7+vx6zKr9fR/yhImPxy4nbRJ7JoXMaLpNtMQtDa8rOTho5LFg+CdDLk9bqH EbpX3PWvO7PQQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 01 May 2023 14:40:49 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET 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 Subject: [PATCH 4/5] nvmet: Reorder fields in 'struct nvme_dhchap_queue_context' Date: Mon, 1 May 2023 14:40:28 +0200 Message-Id: <829091a6a1d5e20112f8e6b0b3d44b384dc7ae98.1682941568.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764696258034385429?= X-GMAIL-MSGID: =?utf-8?q?1764696258034385429?= Group some variables based on their sizes to reduce holes. On x86_64, this shrinks the size of 'struct nvme_dhchap_queue_context' from 416 to 400 bytes. This structure is kvcalloc()'ed in nvme_auth_init_ctrl(), so it is likely that the allocation can be relatively big. Saving 16 bytes per structure may might a slight difference. Signed-off-by: Christophe JAILLET --- Using pahole Before: ====== struct nvme_dhchap_queue_context { struct list_head entry; /* 0 16 */ struct work_struct auth_work; /* 16 80 */ /* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */ struct nvme_ctrl * ctrl; /* 96 8 */ struct crypto_shash * shash_tfm; /* 104 8 */ struct crypto_kpp * dh_tfm; /* 112 8 */ void * buf; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ int qid; /* 128 4 */ int error; /* 132 4 */ u32 s1; /* 136 4 */ u32 s2; /* 140 4 */ u16 transaction; /* 144 2 */ u8 status; /* 146 1 */ u8 hash_id; /* 147 1 */ /* XXX 4 bytes hole, try to pack */ size_t hash_len; /* 152 8 */ u8 dhgroup_id; /* 160 1 */ u8 c1[64]; /* 161 64 */ /* --- cacheline 3 boundary (192 bytes) was 33 bytes ago --- */ u8 c2[64]; /* 225 64 */ /* --- cacheline 4 boundary (256 bytes) was 33 bytes ago --- */ u8 response[64]; /* 289 64 */ /* XXX 7 bytes hole, try to pack */ /* --- cacheline 5 boundary (320 bytes) was 40 bytes ago --- */ u8 * host_response; /* 360 8 */ u8 * ctrl_key; /* 368 8 */ int ctrl_key_len; /* 376 4 */ /* XXX 4 bytes hole, try to pack */ /* --- cacheline 6 boundary (384 bytes) --- */ u8 * host_key; /* 384 8 */ int host_key_len; /* 392 4 */ /* XXX 4 bytes hole, try to pack */ u8 * sess_key; /* 400 8 */ int sess_key_len; /* 408 4 */ /* size: 416, cachelines: 7, members: 25 */ /* sum members: 393, holes: 4, sum holes: 19 */ /* padding: 4 */ /* last cacheline: 32 bytes */ }; After: ===== struct nvme_dhchap_queue_context { struct list_head entry; /* 0 16 */ struct work_struct auth_work; /* 16 80 */ /* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */ struct nvme_ctrl * ctrl; /* 96 8 */ struct crypto_shash * shash_tfm; /* 104 8 */ struct crypto_kpp * dh_tfm; /* 112 8 */ void * buf; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ int qid; /* 128 4 */ int error; /* 132 4 */ u32 s1; /* 136 4 */ u32 s2; /* 140 4 */ u16 transaction; /* 144 2 */ u8 status; /* 146 1 */ u8 dhgroup_id; /* 147 1 */ u8 hash_id; /* 148 1 */ /* XXX 3 bytes hole, try to pack */ size_t hash_len; /* 152 8 */ u8 c1[64]; /* 160 64 */ /* --- cacheline 3 boundary (192 bytes) was 32 bytes ago --- */ u8 c2[64]; /* 224 64 */ /* --- cacheline 4 boundary (256 bytes) was 32 bytes ago --- */ u8 response[64]; /* 288 64 */ /* --- cacheline 5 boundary (320 bytes) was 32 bytes ago --- */ u8 * host_response; /* 352 8 */ u8 * ctrl_key; /* 360 8 */ u8 * host_key; /* 368 8 */ u8 * sess_key; /* 376 8 */ /* --- cacheline 6 boundary (384 bytes) --- */ int ctrl_key_len; /* 384 4 */ int host_key_len; /* 388 4 */ int sess_key_len; /* 392 4 */ /* size: 400, cachelines: 7, members: 25 */ /* sum members: 393, holes: 1, sum holes: 3 */ /* padding: 4 */ /* last cacheline: 16 bytes */ }; --- drivers/nvme/host/auth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c index ea16a0aba679..daf5d144a8ea 100644 --- a/drivers/nvme/host/auth.c +++ b/drivers/nvme/host/auth.c @@ -30,18 +30,18 @@ struct nvme_dhchap_queue_context { u32 s2; u16 transaction; u8 status; + u8 dhgroup_id; u8 hash_id; size_t hash_len; - u8 dhgroup_id; u8 c1[64]; u8 c2[64]; u8 response[64]; u8 *host_response; u8 *ctrl_key; - int ctrl_key_len; u8 *host_key; - int host_key_len; u8 *sess_key; + int ctrl_key_len; + int host_key_len; int sess_key_len; }; From patchwork Mon May 1 12:40:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 89036 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2669171vqo; Mon, 1 May 2023 05:50:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ47eAvqkOQrDRTE9WfCbL6iI0nusBiPnVQWJOw7SYfi9ZqhNcNaW2Nv9zsw7laIDTlc//2b X-Received: by 2002:a17:902:ecc2:b0:1a8:1867:1f7c with SMTP id a2-20020a170902ecc200b001a818671f7cmr15900417plh.40.1682945416756; Mon, 01 May 2023 05:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682945416; cv=none; d=google.com; s=arc-20160816; b=n2wxBxuNlX/3vT//nvnjXd55nW791PUx3M+ZWj37ofbXB2cHO0c4oCd+yJDiY4gIuA EaDHDSTaakgxDzMNwXdT6mBPIIDhKDxYa8yuLGoqgNME10d7WZvgJSIMuM87aThcM3vd 8hCbm23hKCdZmcCWh+wNAlJgqW7MuNCO63+Vc0MG6jzw9vp+geUo8MQ5lzcO/v1HUbSh Y5WDtfA1CgH8Mt6XRS70mCd5hlHiY3gZ0Gd5wQYI3ISU+jbAb2EFiNPMQ78ncOp6Ne/V nR/0z9VFI85usq09PlDAR1n+xis3ssEolVvC/DKaJ1SkxVoImmV2Z0qVoBls27cklHef lsjg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2WOGiov/m2pA1t59sXGUsmU4eYhd1snXKoF3h/t1OiE=; b=HgUagYUZO4rJYBG+sWZSbaSZA8wXvizF424MttVsenUxufKrjOKuCZTae3KR6mWT/+ Avp02FOtBIzV3frTtJxnBivCtAgdbqgh8AdVwDvnZgTL3IdO0ULdgVjO3YJ9as+j8aDs hrJFNEyDzg1fjPfFGQ9EGUYWwUYFvobn3o5MCJIoSTDFZ3Zt+/5ZLb9inDXEXbHJHOJz SYw2ZT/EFhHGaLrLR/7p2puL+pQfN0JcmGTFHcFnCpe+GZgYrfZQ3Ouyo7XW3WiwJ6bv eHrtsXU1nFK7a4oiB17OSIwf6a7GjRjCBOpPTq/FNINMobeDIY9dITJSIPLskuApYOm6 vxzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=aNBie3PY; 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 q10-20020a170902f78a00b001a6e719421asi27703711pln.366.2023.05.01.05.50.01; Mon, 01 May 2023 05:50:16 -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=aNBie3PY; 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 S232592AbjEAMlx (ORCPT + 99 others); Mon, 1 May 2023 08:41:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232600AbjEAMls (ORCPT ); Mon, 1 May 2023 08:41:48 -0400 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA6B01BD5 for ; Mon, 1 May 2023 05:41:13 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id tSpZpM6hwpwRItSpmpInbR; Mon, 01 May 2023 14:40:50 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682944850; bh=2WOGiov/m2pA1t59sXGUsmU4eYhd1snXKoF3h/t1OiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aNBie3PYKeQ+8ngqAp7gsv76YqsQqflNrSky9N0LmN8gnXehQ+LPWDHAKmWUZUb5L qsryuuTtFwuT+8QLeVPZK8Zx3uTwcqBcroYA4Svslx2AERgndJNOwav/rHzQmmr6Mt WNqcz6/9GRlSmXpRvtD2wGpLxh8XBgbtjjlHMaaYJFvW15zdeSgBcyUSRlqzHENnkr 6VJeeolJ/3v39moz7s+K3sWA9Vj20SGC4IDN+L38BMKjEQyMKBiSP0hYYFefHTIAeg MXlmJv5KKgsmvCmlX3f3iQr9pOzOI1JbmsjQdVqFz3sk2arnzQjmqdofkyNKX3kFQI mWurVPEaMkiPw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 01 May 2023 14:40:50 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET 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 Subject: [PATCH 5/5] nvmet: Reorder fields in 'struct nvmefc_fcp_req' Date: Mon, 1 May 2023 14:40:29 +0200 Message-Id: <9433a896eae368a65f430f4eb7310c56da81d954.1682941568.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 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=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764696173512788639?= X-GMAIL-MSGID: =?utf-8?q?1764696173512788639?= Group some variables based on their sizes to reduce holes. On x86_64, this shrinks the size of 'struct nvmefc_fcp_req' from 112 to 104 bytes. This structure is embedded in some other structures (nvme_fc_fcp_op which itself is embedded in nvme_fcp_op_w_sgl), so it helps reducing the size of these structures too. Signed-off-by: Christophe JAILLET --- Using pahole Before: ====== struct nvmefc_fcp_req { void * cmdaddr; /* 0 8 */ void * rspaddr; /* 8 8 */ dma_addr_t cmddma; /* 16 8 */ dma_addr_t rspdma; /* 24 8 */ u16 cmdlen; /* 32 2 */ u16 rsplen; /* 34 2 */ u32 payload_length; /* 36 4 */ struct sg_table sg_table; /* 40 16 */ struct scatterlist * first_sgl; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ int sg_cnt; /* 64 4 */ enum nvmefc_fcp_datadir io_dir; /* 68 4 */ __le16 sqid; /* 72 2 */ /* XXX 6 bytes hole, try to pack */ void (*done)(struct nvmefc_fcp_req *); /* 80 8 */ void * private; /* 88 8 */ u32 transferred_length; /* 96 4 */ u16 rcv_rsplen; /* 100 2 */ /* XXX 2 bytes hole, try to pack */ u32 status; /* 104 4 */ /* size: 112, cachelines: 2, members: 17 */ /* sum members: 100, holes: 2, sum holes: 8 */ /* padding: 4 */ /* last cacheline: 48 bytes */ } __attribute__((__aligned__(8))); After: ===== struct nvmefc_fcp_req { void * cmdaddr; /* 0 8 */ void * rspaddr; /* 8 8 */ dma_addr_t cmddma; /* 16 8 */ dma_addr_t rspdma; /* 24 8 */ u16 cmdlen; /* 32 2 */ u16 rsplen; /* 34 2 */ u32 payload_length; /* 36 4 */ struct sg_table sg_table; /* 40 16 */ struct scatterlist * first_sgl; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ int sg_cnt; /* 64 4 */ enum nvmefc_fcp_datadir io_dir; /* 68 4 */ void (*done)(struct nvmefc_fcp_req *); /* 72 8 */ void * private; /* 80 8 */ __le16 sqid; /* 88 2 */ u16 rcv_rsplen; /* 90 2 */ u32 transferred_length; /* 92 4 */ u32 status; /* 96 4 */ /* size: 104, cachelines: 2, members: 17 */ /* padding: 4 */ /* last cacheline: 40 bytes */ } __attribute__((__aligned__(8))); --- include/linux/nvme-fc-driver.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h index fa092b9be2fd..4109f1bd6128 100644 --- a/include/linux/nvme-fc-driver.h +++ b/include/linux/nvme-fc-driver.h @@ -185,7 +185,6 @@ enum nvmefc_fcp_datadir { * @first_sgl: memory for 1st scatter/gather list segment for payload data * @sg_cnt: number of elements in the scatter/gather list * @io_dir: direction of the FCP request (see NVMEFC_FCP_xxx) - * @sqid: The nvme SQID the command is being issued on * @done: The callback routine the LLDD is to invoke upon completion of * the FCP operation. req argument is the pointer to the original * FCP IO operation. @@ -194,12 +193,13 @@ enum nvmefc_fcp_datadir { * while processing the operation. The length of the buffer * corresponds to the fcprqst_priv_sz value specified in the * nvme_fc_port_template supplied by the LLDD. + * @sqid: The nvme SQID the command is being issued on * * Values set by the LLDD indicating completion status of the FCP operation. * Must be set prior to calling the done() callback. + * @rcv_rsplen: length, in bytes, of the FCP RSP IU received. * @transferred_length: amount of payload data, in bytes, that were * transferred. Should equal payload_length on success. - * @rcv_rsplen: length, in bytes, of the FCP RSP IU received. * @status: Completion status of the FCP operation. must be 0 upon success, * negative errno value upon failure (ex: -EIO). Note: this is * NOT a reflection of the NVME CQE completion status. Only the @@ -219,14 +219,14 @@ struct nvmefc_fcp_req { int sg_cnt; enum nvmefc_fcp_datadir io_dir; - __le16 sqid; - void (*done)(struct nvmefc_fcp_req *req); void *private; - u32 transferred_length; + __le16 sqid; + u16 rcv_rsplen; + u32 transferred_length; u32 status; } __aligned(sizeof(u64)); /* alignment for other things alloc'd with */