[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKjSmnTSzzHdnP-HEYMajrz+MOrjFooaMFop4Vo43kLdg@mail.gmail.com>
Date: Thu, 21 Apr 2022 09:06:05 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: netdev <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH net] net: Use this_cpu_inc() to increment net->core_stats
On Thu, Apr 21, 2022 at 7:00 AM Sebastian Andrzej Siewior
<bigeasy@...utronix.de> wrote:
>
> for_each_possible_cpu(i) {
> core_stats = per_cpu_ptr(p, i);
> - storage->rx_dropped += local_read(&core_stats->rx_dropped);
> - storage->tx_dropped += local_read(&core_stats->tx_dropped);
> - storage->rx_nohandler += local_read(&core_stats->rx_nohandler);
> + storage->rx_dropped += core_stats->rx_dropped;
> + storage->tx_dropped += core_stats->tx_dropped;
> + storage->rx_nohandler += core_stats->rx_nohandler;
I think that one of the reasons for me to use local_read() was that
it provided what was needed to avoid future syzbot reports.
Perhaps use READ_ONCE() here ?
Yes, we have many similar folding loops that are simply assuming
compiler won't do stupid things.
Powered by blists - more mailing lists