[dpdk-dev] release/acquire memory barriers and ring

Burakov, Anatoly anatoly.burakov at intel.com
Sat Feb 17 14:59:17 CET 2018


On 13-Feb-18 7:37 PM, Alex Kiselev wrote:
> Hi.
> 
> I've been wondering should I use a release/acquire memory barrier pair
> in order to be sure that the other thread will see the fully/corrected
> initialized object
> passed to it via a dpdk ring or ring itself is a kind of barrier?
> 
> Let's say I have a pseudo code:
> 
> Thread1:
> obj = alloc();
> ...
> obj initialization
> ...
> 
> ??? fence(memory_order_release); ???
> rte_ring_sp_enqueue(ring, obj)
> 
> 
> Thread2:
> ??? fence(memory_order_acquire); ???
> rte_ring_sc_dequeue(ring, obj)
> 
> Should I use fences in that code?
> 
> Thanks.
> 
> --
> Alex
> 

Rings do that automatically, no additional fences needed.

-- 
Thanks,
Anatoly


More information about the dev mailing list