summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-06-24 00:04:38 +0000
committerDavid S. Miller <davem@davemloft.net>2010-06-28 23:24:29 -0700
commitb6b3ecc71a0664d44ed8d087d583aee98fbf492a (patch)
tree078e92d78578d3a8833dd225f71a6b2a982ea5be /include/linux
parenta095cfc40ec7ebe63e9532383c5b5c2a27b14075 (diff)
net: u64_stats_sync improvements
- 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>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/u64_stats_sync.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
index d0505156ed5..b38e3a58de8 100644
--- a/include/linux/u64_stats_sync.h
+++ b/include/linux/u64_stats_sync.h
@@ -23,6 +23,10 @@
* 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,