netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	Coco Li <lixiaoyan@google.com>, David Ahern <dsahern@kernel.org>
Subject: Re: [PATCH net-next] net-device: move gso_partial_features to net_device_read_tx
Date: Sat, 23 Dec 2023 16:16:20 +0000	[thread overview]
Message-ID: <20231223161620.GF201037@kernel.org> (raw)
In-Reply-To: <20231221140747.1171134-1-edumazet@google.com>

On Thu, Dec 21, 2023 at 02:07:47PM +0000, Eric Dumazet wrote:
> dev->gso_partial_features is read from tx fast path for GSO packets.
> 
> Move it to appropriate section to avoid a cache line miss.
> 
> Fixes: 43a71cd66b9c ("net-device: reorganize net_device fast path variables")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Coco Li <lixiaoyan@google.com>
> Cc: David Ahern <dsahern@kernel.org>

Thanks Eric,

FWIIW, this change looks good to me.

Reviewed-by: Simon Horman <horms@kernel.org>

I have a follow-up question below.

...

> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 75c7725e5e4fdf59da55923cd803e084956b0fa0..5d1ec780122919c31e4215358d736aef3f8a0acd 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -2114,6 +2114,7 @@ struct net_device {
>  	const struct net_device_ops *netdev_ops;
>  	const struct header_ops *header_ops;
>  	struct netdev_queue	*_tx;
> +	netdev_features_t	gso_partial_features;
>  	unsigned int		real_num_tx_queues;
>  	unsigned int		gso_max_size;
>  	unsigned int		gso_ipv4_max_size;

While looking at this I came to wonder if it would
be worth adding a 16bit pad a little below this hunk
so that tc_to_txq sits on it's own cacheline.

I'm unsure if the access pattern of tc_to_txq makes this worthwhile.
But if so it would be a simple tweak.

With such a change in place, on top of your patch, the diff of pahole output
on x86_64 is:

@@ -7432,10 +7432,9 @@
        s16                        num_tc;               /*    54     2 */
        unsigned int               mtu;                  /*    56     4 */
        short unsigned int         needed_headroom;      /*    60     2 */
-       struct netdev_tc_txq       tc_to_txq[16];        /*    62    64 */
-
-       /* XXX 2 bytes hole, try to pack */
-
+       u16                        pad1;                 /*    62     2 */
+       /* --- cacheline 1 boundary (64 bytes) --- */
+       struct netdev_tc_txq       tc_to_txq[16];        /*    64    64 */
        /* --- cacheline 2 boundary (128 bytes) --- */
        struct xps_dev_maps *      xps_maps[2];          /*   128    16 */
        struct nf_hook_entries *   nf_hooks_egress;      /*   144     8 */

  reply	other threads:[~2023-12-23 16:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 14:07 [PATCH net-next] net-device: move gso_partial_features to net_device_read_tx Eric Dumazet
2023-12-23 16:16 ` Simon Horman [this message]
2024-01-02 15:50   ` Eric Dumazet
2024-01-02 12:40 ` patchwork-bot+netdevbpf

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=20231223161620.GF201037@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=lixiaoyan@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    /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).