From: Ingo Molnar <mingo@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Frédéric Weisbecker" <fweisbec@gmail.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to 'xchg_or()'
Date: Wed, 16 Mar 2016 09:04:37 +0100 [thread overview]
Message-ID: <20160316080437.GA31133@gmail.com> (raw)
In-Reply-To: <20160315132623.GZ6344@twins.programming.kicks-ass.net>
* Peter Zijlstra <peterz@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
next prev parent reply other threads:[~2016-03-16 8:04 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-14 12:32 [GIT PULL] NOHZ updates for v4.6 Ingo Molnar
2016-03-15 2:44 ` Linus Torvalds
2016-03-15 8:42 ` Peter Zijlstra
2016-03-15 9:49 ` Ingo Molnar
2016-03-15 9:32 ` [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to 'xchg_or()' Ingo Molnar
2016-03-15 10:50 ` Peter Zijlstra
2016-03-15 12:08 ` Ingo Molnar
2016-03-15 12:42 ` Peter Zijlstra
2016-03-15 11:06 ` Peter Zijlstra
2016-03-15 11:59 ` Peter Zijlstra
2016-03-15 12:01 ` Ingo Molnar
2016-03-15 12:32 ` Ingo Molnar
2016-03-15 12:37 ` Ingo Molnar
2016-03-15 13:17 ` Peter Zijlstra
2016-03-15 12:21 ` [PATCH v2] " Ingo Molnar
2016-03-15 13:26 ` Peter Zijlstra
2016-03-16 8:04 ` Ingo Molnar [this message]
2016-03-16 8:29 ` Peter Zijlstra
2016-03-15 17:08 ` Frederic Weisbecker
2016-03-16 8:14 ` Ingo Molnar
2016-03-17 0:54 ` Frederic Weisbecker
2016-03-15 16:18 ` [PATCH] " Linus Torvalds
2016-03-15 9:53 ` [PATCH] nohz: Change tick_dep_mask from 'unsigned long' to 'unsigned int' Ingo Molnar
2016-03-15 12:15 ` Ingo Molnar
2016-03-15 16:30 ` Linus Torvalds
2016-03-15 17:28 ` Frederic Weisbecker
2016-03-15 17:36 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160316080437.GA31133@gmail.com \
--to=mingo@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).