From: David Laight <David.Laight@ACULAB.COM>
To: "'Andrew Lunn'" <andrew@lunn.ch>, "Petr Tesařík" <petr@tesarici.cz>
Cc: Eric Dumazet <edumazet@google.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
"Chen-Yu Tsai" <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
"Samuel Holland" <samuel@sholland.org>,
"open list:STMMAC ETHERNET DRIVER" <netdev@vger.kernel.org>,
"moderated list:ARM/STM32 ARCHITECTURE"
<linux-stm32@st-md-mailman.stormreply.com>,
"moderated list:ARM/STM32 ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>,
"open list:ARM/Allwinner sunXi SoC support"
<linux-sunxi@lists.linux.dev>, Jiri Pirko <jiri@resnulli.us>
Subject: RE: [PATCH] net: stmmac: protect statistics updates with a spinlock
Date: Mon, 8 Jan 2024 10:34:35 +0000 [thread overview]
Message-ID: <d05ca29283eb47df9c58838cb87a887c@AcuMS.aculab.com> (raw)
In-Reply-To: <a8bb0eb0-8398-4e7e-8dc5-6ebf2f981ca8@lunn.ch>
From: Andrew Lunn
> Sent: 05 January 2024 17:37
>
> > This only leaves an atomic_t in hard irq context. I have tried to find
> > something that could relax the requirement, but AFAICS at least some
> > setups use several interrupts that can be delivered to different CPUs
> > simultaneously, and all of them will walk over all channels. So we're
> > left with an atomic_t here.
>
> You might want to consider per CPU statistics. Since each CPU has its
> own structure of statistics, you don't need atomic.
>
> The code actually using the statistics then needs to sum up the per
> CPU statistics, and using syncp should be sufficient for that.
Doesn't that consume rather a lot of memory on systems with
'silly numbers' of cpu?
Updating an atomic_t is (pretty much) the same as taking a lock.
unlock() is also likely to also contain an atomic operation.
So if you update more than two atomic_t it is likely that a lock
will be faster.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2024-01-08 10:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-05 9:15 [PATCH] net: stmmac: protect statistics updates with a spinlock Petr Tesarik
2024-01-05 9:45 ` Jiri Pirko
2024-01-05 10:25 ` Petr Tesařík
2024-01-05 11:25 ` Jiri Pirko
2024-01-05 9:58 ` Eric Dumazet
2024-01-05 10:34 ` Petr Tesařík
2024-01-05 10:48 ` Eric Dumazet
2024-01-05 11:14 ` Petr Tesařík
2024-01-05 13:27 ` Petr Tesařík
2024-01-05 14:26 ` Eric Dumazet
2024-01-05 14:28 ` Eric Dumazet
2024-01-05 14:45 ` Petr Tesařík
2024-01-05 17:36 ` Andrew Lunn
2024-01-05 18:21 ` Petr Tesařík
2024-01-08 10:34 ` David Laight [this message]
2024-01-08 13:41 ` Andrew Lunn
2024-01-08 15:12 ` Petr Tesařík
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=d05ca29283eb47df9c58838cb87a887c@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jernej.skrabec@gmail.com \
--cc=jiri@resnulli.us \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petr@tesarici.cz \
--cc=samuel@sholland.org \
--cc=wens@csie.org \
/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