Re: [PATCH net-next] net: dsa: User per-cpu 64-bit statistics

From: Eric Dumazet
Date: Fri Aug 04 2017 - 13:43:21 EST


On Fri, 2017-08-04 at 10:11 -0700, Eric Dumazet wrote:

> You could add a debug version of u64_stats_update_begin()
>
> doing
>
> int ret = atomic_inc((atomic_t *)syncp);

I meant atomic_inc_return() of course.

>
> BUG_ON(ret & 1);
>
>
> And u64_stats_update_end()
>
> int ret = atomic_inc((atomic_t *)syncp);
>
> BUG_ON(!(ret & 1));
>
>
> We probably could have a CONFIG_DEBUG_U64_STATS that could be used on
> 64bit kernels as well...
>
>
>