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: <20200121.170905.87149625206286035.davem@davemloft.net>
Date:   Tue, 21 Jan 2020 17:09:05 +0100 (CET)
From:   David Miller <davem@...emloft.net>
To:     gautamramk@...il.com
Cc:     netdev@...r.kernel.org, tahiliani@...k.edu.in, jhs@...atatu.com,
        dave.taht@...il.com, toke@...hat.com, kuba@...nel.org,
        stephen@...workplumber.org, lesliemonis@...il.com
Subject: Re: [PATCH net-next v4 05/10] pie: rearrange structure members and
 their initializations

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ