Skip to content

Commit

Permalink
lfring: Use smp_fence(LoadStore) instead of release order in dequeue
Browse files Browse the repository at this point in the history
Change-Id: Idd800bf6f63912438d3c3bc3009d3c0d975df033
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/169217
Tested-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
  • Loading branch information
Ola Liljedahl committed Jan 28, 2019
1 parent 7c2aaa5 commit 84c48e9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/p64_lfring.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,11 @@ p64_lfring_dequeue(p64_lfring_t *lfr,
{
elems[i] = lfr->ring[(head + i) & mask].ptr;
}
smp_fence(LoadStore);//Order loads only
if (UNLIKELY(lfr->flags & P64_LFRING_F_SCDEQ))
{
//Single-consumer
__atomic_store_n(&lfr->head, head + actual, __ATOMIC_RELEASE);
__atomic_store_n(&lfr->head, head + actual, __ATOMIC_RELAXED);
break;
}
//Else lock-free multi-consumer
Expand All @@ -263,7 +264,7 @@ p64_lfring_dequeue(p64_lfring_t *lfr,
&head,//Updated on failure
head + actual,
/*weak*/false,
__ATOMIC_RELEASE,
__ATOMIC_RELAXED,
__ATOMIC_RELAXED));
*index = (uint32_t)head;
return (uint32_t)actual;
Expand Down

0 comments on commit 84c48e9

Please sign in to comment.