From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: Claudiu Manoil <claudiu.manoil@freescale.com>
Cc: <netdev@vger.kernel.org>, "David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next 2/5] gianfar: Cleanup and optimize struct gfar_private
Date: Tue, 12 Feb 2013 11:49:37 -0500 [thread overview]
Message-ID: <511A72A1.8070009@windriver.com> (raw)
In-Reply-To: <511A66A3.7040704@freescale.com>
On 13-02-12 10:58 AM, Claudiu Manoil wrote:
> On 2/12/2013 5:11 PM, Paul Gortmaker wrote:
>> On 13-02-12 07:47 AM, Claudiu Manoil wrote:
>>> * group run-time critical fields within the 1st cacheline
>>> followed by the tx|rx_queue reference arrays and the interrupt
>>> group instances (gfargrp) (all cacheline aligned)
>>> * change 'padding' from unsigned short to u16
>>> * clear 20+ byte memory hole
>>
>> Per prev. mail, it gets harder to see which change is where,
>> when they are all lumped together like this. For example, it
>> wasn't obvious to me where the 20 byte hole was. Also, it
>> doesn't look like you changed the padding, but rather instead
>> totally re-purposed it, leaving no alignment padding after the
>> uchar bitfields (where it was originally).
>>
>> P.
>
> The 20 byte hole was here:
>
> struct gfar_private {
> unsigned int num_tx_queues;
> unsigned int num_rx_queues;
> unsigned int num_grps;
> unsigned int mode;
> unsigned int total_tx_ring_size;
> unsigned int total_rx_ring_size;
> struct device_node * node;
> struct net_device * ndev;
> /* --- cacheline 1 boundary (32 bytes) --- */
> struct platform_device * ofdev;
> enum gfar_errata errata;
>
> /* XXX 24 bytes hole, try to pack */
OK, so this is good information, that wasn't in your commit log.
(Is it 20 or 24 though? I'm guessing 24, and original commit
log was wrong in saying 20.)
Something like:
"The default gcc layout of gfar_private leaves an implicit 24
byte hole (bytes XYZ --> ABC in the 1st cache line) after the
errata enum...."
>
> /* --- cacheline 2 boundary (64 bytes) --- */
> struct gfar_priv_grp gfargrp[2];
>
>
> At the end of the patch series the first cacheline is without holes.
> Please note that the re-grouping of members and their order is most
> important. For instance why keep in the first cacheline something
The importance of ordering and alignment was never in question. What
was missing, was conveying to the reviewer exactly how you'd made it
better, without forcing them to manually deconstruct gfar_priv in the
before and after cases, esp. when you'd already done that analysis.
> as unimportant as total_rx_ring_size? Members like rx_buffer_size,
> or padding, or even errata, are critical however for the fast path.
> Rx processing (gfar_poll + clean_rx_ring) is the bottleneck here,
> keeping the CPU to 100%. So the main goal is to optimize this path,
> including memory access/cache optimizations. For instance, better
> results were obtained by inverting rx|tx_queue[] with gfargrp[], originally:
> /* --- cacheline 1 boundary (32 bytes) --- */
> struct gfar_priv_tx_q * tx_queue[8]; /* 32 32 */
> /* --- cacheline 2 boundary (64 bytes) --- */
> struct gfar_priv_rx_q * rx_queue[8]; /* 64 32 */
> /* --- cacheline 3 boundary (96 bytes) --- */
> struct gfar_priv_grp gfargrp[2]; /* 96 192 */
>
> The uchar bitfields are unimportant here (used at "init time"), and
> they take 4 bytes including padding anyway. So whether it's uchar or
> uint, it's the same, maybe better left uchar to discourage the abuse
> of these bitfields. (A 2-3byte hole here doesn't change anything
> to the whole structure size, which is padded to be at least a 32B
> multiple.)
This here too, i.e. why the padding after the bitfields is unimportant
and hence removed should also be in the long log.
Thanks,
Paul.
--
>
> Thanks,
> Claudiu
>
>
next prev parent reply other threads:[~2013-02-12 16:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-12 12:47 [PATCH net-next 1/5] gianfar: Cleanup device refs in gfar_private Claudiu Manoil
2013-02-12 12:47 ` [PATCH net-next 2/5] gianfar: Cleanup and optimize struct gfar_private Claudiu Manoil
2013-02-12 12:47 ` [PATCH net-next 3/5] gianfar: GRO_DROP is unlikely Claudiu Manoil
2013-02-12 12:47 ` [PATCH net-next 4/5] gianfar: Remove wrong buffer size conditioning to VLAN h/w offload Claudiu Manoil
2013-02-12 12:47 ` [PATCH net-next 5/5] gianfar: Fix and cleanup Rx FCB handling Claudiu Manoil
2013-02-12 17:19 ` Paul Gortmaker
2013-02-13 11:34 ` Claudiu Manoil
2013-02-13 14:32 ` Paul Gortmaker
2013-02-12 16:30 ` [PATCH net-next 3/5] gianfar: GRO_DROP is unlikely Paul Gortmaker
2013-02-12 16:47 ` Eric Dumazet
2013-02-12 17:05 ` Claudiu Manoil
2013-02-12 15:11 ` [PATCH net-next 2/5] gianfar: Cleanup and optimize struct gfar_private Paul Gortmaker
2013-02-12 15:58 ` Claudiu Manoil
2013-02-12 16:49 ` Paul Gortmaker [this message]
2013-02-12 14:54 ` [PATCH net-next 1/5] gianfar: Cleanup device refs in gfar_private Paul Gortmaker
2013-02-12 17:14 ` Claudiu Manoil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=511A72A1.8070009@windriver.com \
--to=paul.gortmaker@windriver.com \
--cc=claudiu.manoil@freescale.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).