[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <813acfa36558d355e6b56b17bd6bce1c67f77296.camel@redhat.com>
Date: Thu, 10 Mar 2022 10:26:09 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: netdev <netdev@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>,
jeffreyji <jeffreyji@...gle.com>,
Brian Vazquez <brianvv@...gle.com>
Subject: Re: [PATCH v2 net-next] net: add per-cpu storage and net->core_stats
Hello,
On Wed, 2022-03-09 at 16:46 -0800, Eric Dumazet wrote:
> @@ -10282,6 +10282,24 @@ void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
> }
> EXPORT_SYMBOL(netdev_stats_to_stats64);
>
> +struct net_device_core_stats *netdev_core_stats_alloc(struct net_device *dev)
> +{
> + struct net_device_core_stats __percpu *p;
> +
> + p = alloc_percpu_gfp(struct net_device_core_stats,
> + GFP_ATOMIC | __GFP_NOWARN);
> +
> + if (p && cmpxchg(&dev->core_stats, NULL, p))
> + free_percpu(p);
> +
> + p = dev->core_stats;
Don't we need a READ_ONCE() here? if the allocation fails (!p) there is
no memory barrier.
Thanks!
Paolo
Powered by blists - more mailing lists