[dpdk-dev] [PATCH v2 3/3] test/ring_perf: replace sync builtins with atomic builtins
Honnappa Nagarahalli
Honnappa.Nagarahalli at arm.com
Mon Apr 1 18:24:24 CEST 2019
<snip>
> diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c index
> ebb3939..e851c1a 100644
> --- a/app/test/test_ring_perf.c
> +++ b/app/test/test_ring_perf.c
> @@ -160,7 +160,11 @@ enqueue_bulk(void *p)
> unsigned i;
> void *burst[MAX_BURST] = {0};
>
> - if ( __sync_add_and_fetch(&lcore_count, 1) != 2 )
> +#ifdef RTE_USE_C11_MEM_MODEL
> + if (__atomic_add_fetch(&lcore_count, 1, __ATOMIC_RELAXED) != 2)
> #else
> + if (__sync_add_and_fetch(&lcore_count, 1) != 2) #endif
> while(lcore_count != 2)
> rte_pause();
Since, rte_ring library has both C11 and non-C11 implementations, conditional compilation should be fine here.
>
> @@ -196,7 +200,11 @@ dequeue_bulk(void *p)
> unsigned i;
> void *burst[MAX_BURST] = {0};
>
> - if ( __sync_add_and_fetch(&lcore_count, 1) != 2 )
> +#ifdef RTE_USE_C11_MEM_MODEL
> + if (__atomic_add_fetch(&lcore_count, 1, __ATOMIC_RELAXED) != 2)
> #else
> + if (__sync_add_and_fetch(&lcore_count, 1) != 2) #endif
> while(lcore_count != 2)
> rte_pause();
>
> --
> 2.7.4
More information about the dev
mailing list