From patchwork Sun Jun 18 09:46:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 109602 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2416505vqr; Sun, 18 Jun 2023 04:47:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5L1pewlHv4n4H4EJkdUCbQFTpMjD7uak5J7OAomyjj52/fAXGCVR+L3DLD3sb05VjE3O4k X-Received: by 2002:a17:902:ec85:b0:1b0:f31:a386 with SMTP id x5-20020a170902ec8500b001b00f31a386mr19593466plg.26.1687088867920; Sun, 18 Jun 2023 04:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687088867; cv=none; d=google.com; s=arc-20160816; b=AuvAGecmGMM232SQ0KnVUKJ34BitdEGK8BOkby4mC7frYWb4lrOnxKpdFAOlV5LcB8 RlyVP+87sHNAx6o8NnD1wGsZV713z+3iqE5ueRx4WVw2aOTUVNJKFHUPQ2nNltLDxFci Y3cZZeTEC/xqm2rh49LC2aZ4nUckTlENAmfqGl1aB9QkNR9wB/44w9i5TGRGggaryQOM PO+kFSTgRwi2u6+s05dzsek3Hbt/S/MZZ8l1uzWNC7AN7grbQE3lFnXKRIRYS/5Z1HpV Mc/sdmE3j+zkwDjV+JZsGoIbritmB2bp+7C53h2vAkr2wBaVG4RvJ4vXwoL6RMCEOUf/ BYSw== 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=McAeXz2J4UO1BECLY75Q24ChR053II0UqATm+dnPZxw=; b=NPoYWBPt4alrkfVgCT0Xxra8o+/DuWbkCSK33cJV9wCj4N7qBctRfm6O7HTHs3sP1W m0iQTxCsAGEY7Z5I096zJ8U31pUIrdxBt/vmrIRImj09ekE9nNg3NQrq0JyX6DDW1+BK iuimpiSYgVxd6p3isWHNiJU9HWQjwAIxxMGZBzhNHD5fYVkvF/TqKJGpuGeGMQIJ0K9t d998MMXb+eyS9ZovuV76zy7BjFEep2ShLTDVatkZrFoLIXFiSPAfP1GlohAkuTnlo6mi 9ZQWLjBbLCBdJ0c2sQwwKzOTLrGntSXZ+fAFgBVZaFxe7ChIvpvo6lYkvoS3mPmKNgb8 8MDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=q67rMZnT; 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 u12-20020a170903124c00b001a6f0e81ec7si20356683plh.237.2023.06.18.04.47.33; Sun, 18 Jun 2023 04:47:47 -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=q67rMZnT; 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 S229478AbjFRJqy (ORCPT + 99 others); Sun, 18 Jun 2023 05:46:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjFRJqv (ORCPT ); Sun, 18 Jun 2023 05:46:51 -0400 Received: from smtp.smtpout.orange.fr (smtp-26.smtpout.orange.fr [80.12.242.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF91E10C4 for ; Sun, 18 Jun 2023 02:46:50 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id AozfqabYVEYhqAozfqlrwt; Sun, 18 Jun 2023 11:46:49 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1687081609; bh=McAeXz2J4UO1BECLY75Q24ChR053II0UqATm+dnPZxw=; h=From:To:Cc:Subject:Date; b=q67rMZnTDuv5OjLYdkOvp6ilJo6+ksdle57v4Zxzt272ZA4hRFtvynP0Ahhm2BKjp TRac47I8b6MwG85Lh25bHHwhWyECgazWwVDhqkilAFsspTUL3IfDCd9RNZQ4Fkt+6C OBVTMJnS3Vy4CGh+s7lbzC59py2LUrshOiGqL/VL50qmvQ6HuSLUaVOxwZ9kXfxr4A 3rnm68FSGkOhi/xF263vENFM0Pc+ERxijNH0XPAgN9+vwF6EcYqMcyJD7987/B9LqY +aWlIWBlE5UUx8WZaxSD5H9A+qCE4NqpsA76hl3X/SQT3H9lFjDBkRuZiIleVWEtR5 86mGZAHzlCuXQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 18 Jun 2023 11:46:49 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Matthieu Baerts , Mat Martineau , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org, mptcp@lists.linux.dev Subject: [PATCH net-next] mptcp: Reorder fields in 'struct mptcp_pm_add_entry' Date: Sun, 18 Jun 2023 11:46:46 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 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=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?1769040897184970738?= X-GMAIL-MSGID: =?utf-8?q?1769040897184970738?= Group some variables based on their sizes to reduce hole and avoid padding. On x86_64, this shrinks the size of 'struct mptcp_pm_add_entry' from 136 to 128 bytes. It saves a few bytes of memory and is more cache-line friendly. Signed-off-by: Christophe JAILLET Reviewed-by: Matthieu Baerts Reviewed-by: Jiri Pirko --- Using pahole Before: ====== struct mptcp_pm_add_entry { struct list_head list; /* 0 16 */ struct mptcp_addr_info addr; /* 16 12 */ /* XXX 4 bytes hole, try to pack */ struct timer_list add_timer; /* 32 88 */ /* --- cacheline 1 boundary (64 bytes) was 56 bytes ago --- */ struct mptcp_sock * sock; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ u8 retrans_times; /* 128 1 */ /* size: 136, cachelines: 3, members: 5 */ /* sum members: 125, holes: 1, sum holes: 4 */ /* padding: 7 */ /* last cacheline: 8 bytes */ }; After: ===== struct mptcp_pm_add_entry { struct list_head list; /* 0 16 */ struct mptcp_addr_info addr; /* 16 12 */ u8 retrans_times; /* 28 1 */ /* XXX 3 bytes hole, try to pack */ struct timer_list add_timer; /* 32 88 */ /* --- cacheline 1 boundary (64 bytes) was 56 bytes ago --- */ struct mptcp_sock * sock; /* 120 8 */ /* size: 128, cachelines: 2, members: 5 */ /* sum members: 125, holes: 1, sum holes: 3 */ }; --- net/mptcp/pm_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index a12a87b780f6..a56718ffdd02 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -25,9 +25,9 @@ static int pm_nl_pernet_id; struct mptcp_pm_add_entry { struct list_head list; struct mptcp_addr_info addr; + u8 retrans_times; struct timer_list add_timer; struct mptcp_sock *sock; - u8 retrans_times; }; struct pm_nl_pernet {