Re: [PATCH net-next v3 2/2] net: dsa: yt921x: Protect MIB stats with a lock
From: Jakub Kicinski
Date: Mon Jan 05 2026 - 18:37:55 EST
On Mon, 5 Jan 2026 10:51:39 +0800 Qingfang Deng wrote:
> On Mon, 5 Jan 2026 10:09:01 +0800, David Yang wrote:
> > 64bit variables might not be atomic on 32bit architectures, thus cannot
> > be made lock-free. Protect them with a spin lock since get_stats64()
> > cannot sleep.
>
> Synchronizing both reads and updates with a spin lock is an overkill.
> See include/linux/u64_stats_sync.h for a better approach.
OTOH seq locks require error prone retry logic, YMMV.