[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d05ca29283eb47df9c58838cb87a887c@AcuMS.aculab.com>
Date: Mon, 8 Jan 2024 10:34:35 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Andrew Lunn' <andrew@...n.ch>, Petr Tesařík
<petr@...arici.cz>
CC: Eric Dumazet <edumazet@...gle.com>, Alexandre Torgue
<alexandre.torgue@...s.st.com>, Jose Abreu <joabreu@...opsys.com>, "David S.
Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Maxime Coquelin <mcoquelin.stm32@...il.com>, "Chen-Yu
Tsai" <wens@...e.org>, Jernej Skrabec <jernej.skrabec@...il.com>, "Samuel
Holland" <samuel@...lland.org>, "open list:STMMAC ETHERNET DRIVER"
<netdev@...r.kernel.org>, "moderated list:ARM/STM32 ARCHITECTURE"
<linux-stm32@...md-mailman.stormreply.com>, "moderated list:ARM/STM32
ARCHITECTURE" <linux-arm-kernel@...ts.infradead.org>, open list
<linux-kernel@...r.kernel.org>, "open list:ARM/Allwinner sunXi SoC support"
<linux-sunxi@...ts.linux.dev>, Jiri Pirko <jiri@...nulli.us>
Subject: RE: [PATCH] net: stmmac: protect statistics updates with a spinlock
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)
Powered by blists - more mailing lists