[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2965be9f-72b8-4972-0580-f96b2a562018@iogearbox.net>
Date: Tue, 17 Oct 2023 10:52:39 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Coco Li <lixiaoyan@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>, Neal Cardwell <ncardwell@...gle.com>,
Mubashir Adnan Qureshi <mubashirq@...gle.com>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, Chao Wu <wwchao@...gle.com>,
Wei Wang <weiwan@...gle.com>, David Ahern <dsahern@...nel.org>
Subject: Re: [PATCH v2 net-next 4/5] net-device: reorganize net_device fast
path variables
Hi Coco,
Thanks for looking into this, awesome work!
On 10/17/23 3:47 AM, Coco Li wrote:
> Reorganize fast path variables on tx-txrx-rx order
> Fastpath variables end after npinfo.
>
> Below data generated with pahole on x86 architecture.
>
> Fast path variables span cache lines before change: 12
> Fast path variables span cache lines after change: 4
>
> Signed-off-by: Coco Li <lixiaoyan@...gle.com>
> Suggested-by: Eric Dumazet <edumazet@...gle.com>
> Reviewed-by: David Ahern <dsahern@...nel.org>
> ---
> include/linux/netdevice.h | 99 ++++++++++++++++++++-------------------
> 1 file changed, 52 insertions(+), 47 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 1c7681263d302..d72b71b76bf82 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -2053,6 +2053,58 @@ enum netdev_ml_priv_type {
> */
>
> struct net_device {
> + /* Caacheline organization can be found documented in
tiny nit: typo
> + * Documentation/networking/net_cachelines/net_device.rst.
I think this doc is not based on current struct net_device as I saw
some members in there which are not in net_device anymore today?
For the doc, please document also tcx_ingress member as fastpath_rx_access
(sch_handle_ingress) and tcx_egress member as fastpath_tx_access
(sch_handle_egress).
> + * Please update the document when adding new fields.
> + */
> +
> + /* TX read-mostly hotpath */
> + unsigned long long priv_flags;
> + const struct net_device_ops *netdev_ops;
> + const struct header_ops *header_ops;
> + struct netdev_queue *_tx;
> + unsigned int real_num_tx_queues;
> + unsigned int gso_max_size;
> + unsigned int gso_ipv4_max_size;
> + u16 gso_max_segs;
> + s16 num_tc;
> + /* Note : dev->mtu is often read without holding a lock.
> + * Writers usually hold RTNL.
> + * It is recommended to use READ_ONCE() to annotate the reads,
> + * and to use WRITE_ONCE() to annotate the writes.
> + */
> + unsigned int mtu;
> + unsigned short needed_headroom;
> + struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
> +#ifdef CONFIG_XPS
> + struct xps_dev_maps __rcu *xps_maps[XPS_MAPS_MAX];
> +#endif
> +#ifdef CONFIG_NETFILTER_EGRESS
> + struct nf_hook_entries __rcu *nf_hooks_egress;
> +#endif
As mentioned above, please also add tcx_egress to TX read-mostly
hotpath cacheline.
Thanks,
Daniel
Powered by blists - more mailing lists