diff mbox series

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

Message ID 20190415102100.26664-1-i.maximets@samsung.com
State Accepted
Headers show
Series [ovs-dev] pvector: Document the entry destruction policy. | expand

Commit Message

Ilya Maximets April 15, 2019, 10:21 a.m. UTC
This describes how to safely destroy pvector entries after removal.

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

Wording/spelling suggestions are welcome.

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

Comments

Ben Pfaff April 15, 2019, 7:29 p.m. UTC | #1
On Mon, Apr 15, 2019 at 01:21:00PM +0300, Ilya Maximets wrote:
> This describes how to safely destroy pvector entries after removal.
> 
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>

Applied to master, thanks!
diff mbox series

Patch

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 {