Thread (17 messages) 17 messages, 4 authors, 2020-01-21

Re: [PATCH net-next v4 05/10] pie: rearrange structure members and their initializations

From: David Miller <davem@davemloft.net>
Date: 2020-01-21 16:09:13

From: Gautam Ramakrishnan <redacted>
Date: Tue, 21 Jan 2020 21:14:50 +0530
On Tue, Jan 21, 2020 at 8:05 PM David Miller [off-list ref] wrote:
quoted
From: gautamramk@gmail.com
Date: Tue, 21 Jan 2020 19:42:44 +0530
quoted
From: "Mohit P. Tahiliani" <redacted>

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 <redacted>
Signed-off-by: Leslie Monis <redacted>
Signed-off-by: Gautam Ramakrishnan <redacted>
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help