On Fri, Jul 04, 2014 at 07:21:17AM -0700, Jarno Rajahalme wrote:
> When a reference counted object is also RCU protected the deletion of
> the object's memory is always postponed.  This allows
> memory_order_relaxed to be used also for unreferencing, as RCU
> quiescing provides a full memory barrier (it has to, or otherwise
> there could be lingering accesses to objects after they are recycled).
> 
> Also, when access to the reference counted object is protected via a
> mutex or a lock, the locking primitives provide the required memory
> barrier functionality.
> 
> Also, add ovs_refcount_try_ref_rcu(), which takes a reference only if
> the refcount is non-zero and returns true if a reference was taken,
> false otherwise.  This can be used in combined RCU/refcount scenarios
> where we have an RCU protected reference to an refcounted object, but
> which may be unref'ed at any time.  If ovs_refcount_try_ref_rcu()
> fails, the object may still be safely used until the current thread
> quiesces.
> 
> Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>

> +/* Increments 'refcount', but only if it is non-zero.
> + *
> + * This may only be called an object which is RCU protected during
> + * this call.  This implies that its possible desctruction is

"destruction"

> + * postponed until all current RCU threads quiesce.
> + *
> + * Returns false if the refcount was zero.  In this case the object may
> + * be safely accessed until the current thread quiesces, but no additional

Acked-by: Ben Pfaff <b...@nicira.com>
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to