[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANn89iL0ygQh3=P22x49-kPsAmMSs4uRRqbGFpk4PFo2GKBPtA@mail.gmail.com>
Date: Thu, 10 Mar 2022 08:44:44 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>,
jeffreyji <jeffreyji@...gle.com>,
Brian Vazquez <brianvv@...gle.com>
Subject: Re: [PATCH v2 net-next] net: add per-cpu storage and net->core_stats
On Thu, Mar 10, 2022 at 1:26 AM Paolo Abeni <pabeni@...hat.com> wrote:
>
> 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.
I guess you are right, thanks.
Powered by blists - more mailing lists