[ovs-dev] [PATCH] pvector: Document the entry destruction policy.

Ilya Maximets i.maximets at samsung.com
Mon Apr 15 10:21:00 UTC 2019


This describes how to safely destroy pvector entries after removal.

Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
---

Wording/spelling suggestions are welcome.

 lib/pvector.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/pvector.h b/lib/pvector.h
index b175b213d..b990ed9d5 100644
--- a/lib/pvector.h
+++ b/lib/pvector.h
@@ -54,6 +54,13 @@
  * 'temp' may contain NULL pointers and it may be in unsorted order.  It is
  * sorted before it is published at 'impl', which also removes the NULLs from
  * the published vector.
+ *
+ * Since the vector is RCU protected, the entry destruction after removal must
+ * be RCU postponed.  Also, if it happens before changes published with
+ * pvector_publish(), destruction must be double postponed, i.e., the second
+ * ovsrcu_postpone() call to destruct the entry should be called from the first
+ * RCU callback.  This is required because readers could still obtain the
+ * unmodified vector until updated version is published.
  */
 
 struct pvector_entry {
-- 
2.17.1



More information about the dev mailing list