lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHC9VhTu4dEbi0Sj1F9R+OR=5BfOzQNq5fBF9MWag2QxxMtfwg@mail.gmail.com>
Date:   Mon, 19 Jun 2023 12:06:43 -0400
From:   Paul Moore <paul@...l-moore.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org, netdev@...r.kernel.org,
        linux-security-module@...r.kernel.org
Subject: Re: [PATCH net-next] netlabel: Reorder fields in 'struct netlbl_domaddr6_map'

On Sun, Jun 18, 2023 at 6:16 AM Christophe JAILLET
<christophe.jaillet@...adoo.fr> wrote:
>
> Group some variables based on their sizes to reduce hole and avoid padding.
> On x86_64, this shrinks the size of 'struct netlbl_domaddr6_map'
> from 72 to 64 bytes.
>
> It saves a few bytes of memory and is more cache-line friendly.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> Using pahole
>
> Before:
> ======
> struct netlbl_dom_map {
>         char *                     domain;               /*     0     8 */
>         u16                        family;               /*     8     2 */
>
>         /* XXX 6 bytes hole, try to pack */
>
>         struct netlbl_dommap_def   def;                  /*    16    16 */
>         u32                        valid;                /*    32     4 */
>
>         /* XXX 4 bytes hole, try to pack */
>
>         struct list_head           list;                 /*    40    16 */
>         struct callback_head       rcu __attribute__((__aligned__(8))); /*    56    16 */
>
>         /* size: 72, cachelines: 2, members: 6 */
>         /* sum members: 62, holes: 2, sum holes: 10 */
>         /* forced alignments: 1 */
>         /* last cacheline: 8 bytes */
> } __attribute__((__aligned__(8)));
>
>
> After:
> =====
> struct netlbl_dom_map {
>         char *                     domain;               /*     0     8 */
>         struct netlbl_dommap_def   def;                  /*     8    16 */
>         u16                        family;               /*    24     2 */
>
>         /* XXX 2 bytes hole, try to pack */
>
>         u32                        valid;                /*    28     4 */
>         struct list_head           list;                 /*    32    16 */
>         struct callback_head       rcu __attribute__((__aligned__(8))); /*    48    16 */
>
>         /* size: 64, cachelines: 1, members: 6 */
>         /* sum members: 62, holes: 1, sum holes: 2 */
>         /* forced alignments: 1 */
> } __attribute__((__aligned__(8)));
> ---
>  net/netlabel/netlabel_domainhash.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Paul Moore <paul@...l-moore.com>

-- 
paul-moore.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ