From: Didier Pallard <didier.pall...@6wind.com>

a write memory barrier is needed before changing heap state
value, else some concurrent core may see state changing before
all initialization values are written to memory, causing
unpredictable results in malloc function.

Signed-off-by: Didier Pallard <didier.pallard at 6wind.com>
---
 lib/librte_malloc/malloc_heap.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_malloc/malloc_heap.c b/lib/librte_malloc/malloc_heap.c
index f4a0294..64668cb 100644
--- a/lib/librte_malloc/malloc_heap.c
+++ b/lib/librte_malloc/malloc_heap.c
@@ -147,6 +147,7 @@ malloc_heap_init(struct malloc_heap *heap)
                         */
                        heap->numa_socket = heap - mcfg->malloc_heaps;
                        rte_spinlock_init(&heap->lock);
+                       rte_wmb();
                        heap->initialised = INITIALISED;
                }
        }
-- 
1.7.10.4

Reply via email to