[PATCH v4 03/27] ring: unify memory model on C11, remove atomic32

Stephen Hemminger stephen at networkplumber.org
Mon Jun 1 23:18:52 CEST 2026


On Mon, 1 Jun 2026 18:18:18 +0000
Konstantin Ananyev <konstantin.ananyev at huawei.com> wrote:

> > +
> > +	/* check that we have enough room in ring */
> > +	if (unlikely(n > *entries))
> > +		n = (behavior == RTE_RING_QUEUE_FIXED) ? 0 : *entries;
> > +
> > +	if (n > 0) {
> > +		*new_head = *old_head + n;
> > +		d->head = *new_head;  
> 
> There is a bit of inconsistency with the 'load' operation above:
> If we use atomic_load(&d->head. ...) then it would be better to use
> atomic_store(&d->head,..., order_relaxed) here.
>  

Will switch to atomic_store, with relaxed.
It generates same code on x86 and ARM as simple store.
And makes C11 checkers happy.


More information about the dev mailing list