* Peter Zijlstra <pet...@infradead.org> wrote:

> On Tue, Mar 15, 2016 at 01:21:45PM +0100, Ingo Molnar wrote:
> >  - Renaming fetch_or() to xchg_or(), recognizing that the semantics
> >    are xchg()-alike.
> 
> Let me add another argument for why I don't like the "exchange/swap
> (and) add" naming.
> 
> Exchange (and swap) replace one value for another, like:
> 
>       old = xchg(ptr, val);
> 
> Whatever was there, gets replaced by the independent value in @val.
> Straight up replacement.
> 
> However with something like xchg_or, you don't do a direct replacement
> with an unrelated value. Instead you modify the pre-existing value. So
> there really isn't an exchange at all.
> 
> So "fetch (and) or" really describes the operation better. You load
> (fetch) the value and then modify it, in an indivisible (aka atomic)
> fashion.

Ok!

Could we at least somehow sneak the notion of 'atomicity' into it?

        fetch_or()
        fetch_and()
        fetch_not()

vs.

        fetch_atomic_or()
        fetch_atomic_and()
        fetch_atomic_not()

vs.

        atomic_fetch_or()
        atomic_fetch_and()
        atomic_fetch_not()

?

Thanks,

        Ingo

Reply via email to