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

Alex Kiselev kiselev99 at gmail.com
Tue Feb 13 20:37:37 CET 2018


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


More information about the dev mailing list