This series introduces a new mechanism (ovsthread-stats) to count statistics
for different objects (mostly flows) in OVS. Each thread has its own copy of
the counters, so updates are very cheap.

The commits are organized in this order:
 - Group statistics update in dpif-netdev (unrelated to the rest of the series)
 - New RCU mechanisms (compare and exchange) and data structures (rcu singly
   linked list)
 - New thread-stats module
 - Changes to dpif-netdev and ofproto to use the new module
 - Remove old ovsthread_stats

No mutex is used during statistics update, therefore we have slightly better
single thread performance and greater scalability

The current limitations are:
 - For each flow (or object that needs to keep stats) exactly one cacheline is
   allocated. This is ok for now, because most of the users need a little less
   that a cacheline.
 - The memory is recycled but never freed.
 - ovsthread_stats_clear() clears one bucket at a time. A concurrent reader
   might see an inconsistent view.  This limitation was also present in the old
   ovsthread_stats mechanism, used in the datapath. Right now this is not a
   problem because we never have one thread that is clearing while another
   thread is reading stats.

Jarno helped me a lot with the RCU mechanisms and data structures

Daniele Di Proietto (10):
  dpif-netdev: Group statistics updates in the slow path
  ovs-rcu: Introduce ovsrcu_compare_exchange()
  ovs-rcu: Allow static pointer non-NULL initialization
  rcu-slist: Introduce RCU-protected singly linked list
  ovs-thread-stats: New truly per-thread stats module
  ovs-thread-stats: Added simple testcase
  dpif-netdev: Use new ovs-thread-stats for flow statistics
  ofproto-dpif: Use new ovs-thread-stats for rule_dpif stats
  dpif-netdev: Use new ovs-thread-stats for datapath stats
  ovs-thread: Removed old unused ovsthread_stats

 lib/automake.mk              |   3 +
 lib/dpif-netdev.c            | 176 +++++++++----------
 lib/ovs-rcu.h                |  87 +++++++++-
 lib/ovs-thread-stats.c       | 393 +++++++++++++++++++++++++++++++++++++++++++
 lib/ovs-thread-stats.h       | 236 ++++++++++++++++++++++++++
 lib/ovs-thread.c             |  56 +-----
 lib/ovs-thread.h             |  32 ----
 lib/rcu-slist.h              |  84 +++++++++
 ofproto/ofproto-dpif-xlate.c |   2 +-
 ofproto/ofproto-dpif.c       | 103 +++++++++---
 tests/automake.mk            |   2 +
 tests/test-stats.c           | 162 ++++++++++++++++++
 tests/testsuite.at           |   1 +
 tests/threadstats.at         |   4 +
 14 files changed, 1129 insertions(+), 212 deletions(-)
 create mode 100644 lib/ovs-thread-stats.c
 create mode 100644 lib/ovs-thread-stats.h
 create mode 100644 lib/rcu-slist.h
 create mode 100644 tests/test-stats.c
 create mode 100644 tests/threadstats.at

-- 
2.1.0.rc1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to