[ovs-dev] [PATCH] datpath: Avoid reporting half updated statistics.
blp at nicira.com
Sat Aug 21 03:21:50 UTC 2010
On Fri, Aug 20, 2010 at 7:46 PM, Jesse Gross <jesse at nicira.com> wrote:
> We enforce mutual exclusion when updating statistics by disabling
> bottom halves and only writing to per-CPU state. However, reading
> requires looking at the statistics for foreign CPUs, which could be
> in the process of updating them since there isn't a lock. This means
> we could get garbage values for 64-bit values on 32-bit machines or
> byte counts that don't correspond to packet counts, etc.
> This commit introduces a sequence lock for statistics values to avoid
> this problem. Getting a write lock is very cheap - it only requires
> incrementing a counter plus a memory barrier (which is compiled away
> on x86) to acquire or release the lock and will never block. On
> read we spin until the sequence number hasn't changed in the middle
> of the operation, indicating that the we have a consistent set of
It looks good to me.
More information about the dev