From patchwork Fri Feb 17 15:55:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 58669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp965407wrn; Fri, 17 Feb 2023 08:02:57 -0800 (PST) X-Google-Smtp-Source: AK7set+1nGYa8AM+iEiK1ZG3OghAoItxQIcRplLtBLZq2FqezBR0MDJAaMUwPE44U+Vuijz/n0NE X-Received: by 2002:aa7:de09:0:b0:4ac:746e:2edf with SMTP id h9-20020aa7de09000000b004ac746e2edfmr1768226edv.9.1676649777495; Fri, 17 Feb 2023 08:02:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676649777; cv=none; d=google.com; s=arc-20160816; b=0zuCUqIjSM9roQyTY3eyJ/dYPQqhv6Caw4asghnBMpukmuQt6YzfgwUl6hF2VV39Im a9XCl/IjwGQuB8jkdb1DLEcZWnQz9UeMSLTVHuX+HhL8T/95/n46qCJ6r+EOoUYC73lX xcdjA6Bt3w2QyEGjHDhr6sPDvFnRdUmmAocrjQdmEmTI3MDkTipGZjo/yHcK3SkcVTed 4Q6OC63t7imC4qoHV15iIOETTVu4V/XaN6m6fO8TBPnYm4k1BWreJ2XXG3aFg5UpEVXQ 0CN0IkD//mCHvgR+91p7EqLxXYD7XW5b6Q7jlImTtOjKSg6Skx6Tin6WBl2D+TxkEKHq E2qQ== 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; bh=ia+xQIgm94jyC/ROSs7KSI6dgGl8sBGOlSLuaFRR+9s=; b=G+bJJkmK3gSCZvXnELSnPMwpcyzGHnOwzxII6DZVR5G++R5WCDoTZVbnsq83Jg+3TS z9UBJZggL0NWqc6ctuFrlvuHnSgjouooEbtdvhiy9JfROvYmypqE+2AEP4kY/PFstPGe 5dofXru+v7acZoJ6Qhkzes0EjCZhEGBJIBQpgopVO4rD5MAxHgA+GKcnKdkZelCRgzRu 4ykxQ3jLzMCspcGqQCetGtG4ibImBFkJP9N/5gNdKF5uYelVhLg7J6H6AnGiQ9GwwYYo 9uOQShCdADiu0wA2nN2+4bOZ9xswvwnd9hjkXDgI8G8AUiJcqeL7onnMdrLAne/CWkTF GNdg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc25-20020a056402205900b004acaa4dcac4si5529681edb.583.2023.02.17.08.02.27; Fri, 17 Feb 2023 08:02:57 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbjBQP5N (ORCPT + 99 others); Fri, 17 Feb 2023 10:57:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230320AbjBQP5J (ORCPT ); Fri, 17 Feb 2023 10:57:09 -0500 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59C1B711AF for ; Fri, 17 Feb 2023 07:56:41 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id T35cpSuxkFOC9T35cp2ZIu; Fri, 17 Feb 2023 16:56:01 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 17 Feb 2023 16:56:01 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Michael Turquette , Stephen Boyd Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-clk@vger.kernel.org Subject: [PATCH] clk: Reorder fields in 'struct clk_fractional_divider' Date: Fri, 17 Feb 2023 16:55:55 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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?1758094716772228760?= X-GMAIL-MSGID: =?utf-8?q?1758094716772228760?= Group some variables based on their sizes to reduce hole and avoid padding. On x86_64, this shrinks the size of 'struct clk_fractional_divider' from 72 to 64 bytes. It saves a few bytes of memory when the structure is kzalloc()'ed. Signed-off-by: Christophe JAILLET --- Using pahole Before: ====== struct clk_fractional_divider { struct clk_hw hw; /* 0 24 */ void * reg; /* 24 8 */ u8 mshift; /* 32 1 */ u8 mwidth; /* 33 1 */ /* XXX 2 bytes hole, try to pack */ u32 mmask; /* 36 4 */ u8 nshift; /* 40 1 */ u8 nwidth; /* 41 1 */ /* XXX 2 bytes hole, try to pack */ u32 nmask; /* 44 4 */ u8 flags; /* 48 1 */ /* XXX 7 bytes hole, try to pack */ void (*approximation)(struct clk_hw *, long unsigned int, long unsigned int *, long unsigned int *, long unsigned int *); /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ spinlock_t * lock; /* 64 8 */ /* size: 72, cachelines: 2, members: 11 */ /* sum members: 61, holes: 3, sum holes: 11 */ /* last cacheline: 8 bytes */ }; After: ===== struct clk_fractional_divider { struct clk_hw hw; /* 0 24 */ void * reg; /* 24 8 */ u8 flags; /* 32 1 */ u8 mshift; /* 33 1 */ u8 mwidth; /* 34 1 */ /* XXX 1 byte hole, try to pack */ u32 mmask; /* 36 4 */ u8 nshift; /* 40 1 */ u8 nwidth; /* 41 1 */ /* XXX 2 bytes hole, try to pack */ u32 nmask; /* 44 4 */ void (*approximation)(struct clk_hw *, long unsigned int, long unsigned int *, long unsigned int *, long unsigned int *); /* 48 8 */ spinlock_t * lock; /* 56 8 */ /* size: 64, cachelines: 1, members: 11 */ /* sum members: 61, holes: 2, sum holes: 3 */ }; --- include/linux/clk-provider.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index cf1adfeaf257..8cec844f5dde 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -1134,13 +1134,13 @@ struct clk_hw *clk_hw_register_fixed_factor_parent_hw(struct device *dev, struct clk_fractional_divider { struct clk_hw hw; void __iomem *reg; + u8 flags; u8 mshift; u8 mwidth; u32 mmask; u8 nshift; u8 nwidth; u32 nmask; - u8 flags; void (*approximation)(struct clk_hw *hw, unsigned long rate, unsigned long *parent_rate, unsigned long *m, unsigned long *n);