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]
Date:   Tue, 21 Jan 2020 22:14:47 +0530
From:   Leslie Monis <lesliemonis@...il.com>
To:     Toke Høiland-Jørgensen <toke@...hat.com>
Cc:     Gautam Ramakrishnan <gautamramk@...il.com>,
        David Miller <davem@...emloft.net>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>,
        "Mohit P. Tahiliani" <tahiliani@...k.edu.in>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Dave Taht <dave.taht@...il.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH net-next v4 05/10] pie: rearrange structure members and
 their initializations

On Tue, Jan 21, 2020 at 9:32 PM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>
> Gautam Ramakrishnan <gautamramk@...il.com> writes:
>
> > On Tue, Jan 21, 2020 at 8:05 PM David Miller <davem@...emloft.net> wrote:
> >>
> >> From: gautamramk@...il.com
> >> Date: Tue, 21 Jan 2020 19:42:44 +0530
> >>
> >> > From: "Mohit P. Tahiliani" <tahiliani@...k.edu.in>
> >> >
> >> > Rearrange the members of the structures such that they appear in
> >> > order of their types. Also, change the order of their
> >> > initializations to match the order in which they appear in the
> >> > structures. This improves the code's readability and consistency.
> >> >
> >> > Signed-off-by: Mohit P. Tahiliani <tahiliani@...k.edu.in>
> >> > Signed-off-by: Leslie Monis <lesliemonis@...il.com>
> >> > Signed-off-by: Gautam Ramakrishnan <gautamramk@...il.com>
> >>
> >> What matters for structure member ordering is dense packing and
> >> grouping commonly-used-together elements for performance.
> >>
> > We shall reorder the variables as per their appearance in the
> > structure and re-submit. Could you elaborate a bit on dense packing?
>
> The compiler will align struct member offsets according to their size,
> adding padding as necessary to achieve this.
> So this struct:
>
> struct s1 {
>        u32 mem32_1;
>        u64 mem64_1;
>        u32 mem32_2;
>        u64 mem64_2;
> };
>
> will have 4 bytes of padding after both mem32_1 and mem32_2, whereas
> this struct:
>
> struct s2 {
>        u64 mem64_1;
>        u32 mem32_1;
>        u32 mem32_2;
>        u64 mem64_2;
> };
>
> won't. So sizeof(struct s1) == 32, and sizeof(struct s2) == 24, and we
> say that s2 is densely packed, whereas s1 has holes in it.
>
> The pahole tool is useful to see the layout of compiled structures
> (pahole -C). It will also point out any holes.
>
> -Toke
>

Thanks Toke. Used the pahole tool. There seem to be no
problems with the structures in include/net/pie.h, at least not on
an x86_64 system. We might have to change things in sch_pie.c
and sch_fq_pie.c though.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ