]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
net: u64_stats_sync improvements
authorEric Dumazet <eric.dumazet@gmail.com>
Thu, 24 Jun 2010 00:04:38 +0000 (00:04 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 Jun 2010 06:24:29 +0000 (23:24 -0700)
- Add a comment about interrupts:

6) If counter might be written by an interrupt, readers should block
interrupts.

- Fix a typo in sample of use.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/u64_stats_sync.h

index d0505156ed521eeb71205cd371839b839662cda6..b38e3a58de83192d2dc8d452d368252aeda51426 100644 (file)
  *    pure reads. But if they have to fetch many values, it's better to not allow
  *    preemptions/interruptions to avoid many retries.
  *
+ * 6) If counter might be written by an interrupt, readers should block interrupts.
+ *    (On UP, there is no seqcount_t protection, a reader allowing interrupts could
+ *     read partial values)
+ *
  * Usage :
  *
  * Stats producer (writer) should use following template granted it already got
@@ -46,7 +50,7 @@
  *         start = u64_stats_fetch_begin(&stats->syncp);
  *         tbytes = stats->bytes64; // non atomic operation
  *         tpackets = stats->packets64; // non atomic operation
- * } while (u64_stats_fetch_retry(&stats->lock, syncp));
+ * } while (u64_stats_fetch_retry(&stats->syncp, start));
  *
  *
  * Example of use in drivers/net/loopback.c, using per_cpu containers,