[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHv+uoEEwagyM1fVQY1gE_4-5O3wTBba3ANHgZZex1v6XDA6sA@mail.gmail.com>
Date: Tue, 21 Jan 2020 22:22:22 +0530
From: Leslie Monis <lesliemonis@...il.com>
To: David Miller <davem@...emloft.net>
Cc: Gautam Ramakrishnan <gautamramk@...il.com>,
Linux NetDev <netdev@...r.kernel.org>,
"Mohit P. Tahiliani" <tahiliani@...k.edu.in>,
Jamal Hadi Salim <jhs@...atatu.com>,
Dave Taht <dave.taht@...il.com>,
Toke Høiland-Jørgensen <toke@...hat.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:39 PM David Miller <davem@...emloft.net> wrote:
>
> From: Gautam Ramakrishnan <gautamramk@...il.com>
> Date: Tue, 21 Jan 2020 21:14:50 +0530
>
> > 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?
>
> It means eliminating unnecessary padding in the structure. F.e. if
> you have:
>
> u32 x;
> u64 y;
>
> Then 32-bits of wasted space will be inserted after 'x' so that
> 'y' is properly 64-bit aligned.
>
> If in doubt use the 'pahole' tool to see how the structure is
> laid out. It will show you where unnecessary padding exists as
> well.
Thanks David. Do you recommend we discard/keep this patch? pahole
reports no problems with or without this patch. However, we'll be correcting
issues with other structs in sch_pie.c and sch_fq_pie.c.
Powered by blists - more mailing lists