[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231113175204.4193922-1-alexey.pakhunov@spacex.com>
Date: Mon, 13 Nov 2023 09:52:04 -0800
From: Alex Pakhunov <alexey.pakhunov@...cex.com>
To: <andrew@...n.ch>
CC: <alexey.pakhunov@...cex.com>, <linux-kernel@...r.kernel.org>,
<mchan@...adcom.com>, <netdev@...r.kernel.org>,
<prashant@...adcom.com>, <siva.kallam@...adcom.com>,
<vincent.wong2@...cex.com>
Subject: Re: [PATCH v2 1/2] tg3: Move the [rt]x_dropped counters to tg3_napi
Hi,
> Isn't this wrapping artificial? old_stats is of type
> rtnl_link_stats64, so the counters are 64 bit.
The wrapping here is needed as long as tnapi->[rt]x_dropped counters are 32
bit wide. It makes sure the resulting value is correctly wrapped.
tnapi->[rt]x_dropped counters are 32 bit on 32 bit systems to make sure
they can be read atomically.
> Why not use include/linux/u64_stats_sync.h, which should cost you
> nothing on 64 bit machines, and do the right thing on 32 bit machines.
It should be possible to use include/linux/u64_stats_sync.h but it seems
like overkill in this case. First, we mostly care whether the counters are
not zero and/or incremening. We typically don't care about the exact value.
Second, the counters are unlikely to ever reach 4G. Essentially, they are
incremented on memory allocation failures only meaning that the system need
to be in a completely wedged state for a very long time for this to happen.
Given the above additional complexity of u64_stats_sync.h does not seem to
be worth it.
Alex.
Powered by blists - more mailing lists