> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of David Marchand
> Sent: Tuesday, April 15, 2014 2:51 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 1/2] mem: add write memory barrier before
> changing heap state
> 
> From: Didier Pallard <didier.pallard at 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>

No barrier should be necessary here. As in a number of other places, such as 
rings, compiler barriers can be used in place of write memory barriers, due to 
IA ordering rules. However, in this case, both variables referenced are 
volatile variables and so the assignments to them cannot be reordered by the 
compiler so no compiler barrier is necessary either.

Regards,
/Bruce

Reply via email to