[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160315124244.GX6344@twins.programming.kicks-ass.net>
Date: Tue, 15 Mar 2016 13:42:44 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Frédéric Weisbecker <fweisbec@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to
'xchg_or()'
On Tue, Mar 15, 2016 at 01:08:35PM +0100, Ingo Molnar wrote:
> * Peter Zijlstra <peterz@...radead.org> wrote:
>
> > On Tue, Mar 15, 2016 at 10:32:45AM +0100, Ingo Molnar wrote:
> > > 2) its naming sucks. "fetch_or()" does not really signal that it's a
> > > fundamentally atomic operation, nor what API family it belongs to.
> >
> > I disagree there, the fetch-$op naming is widely used for atomic
> > operations that return the previous value. See for example the C/C++11
> > atomic ops.
>
> The problem I see is that we don't really have the fetch_*() naming in the kernel
> right now, while we do have the xchg_*() naming. The latter is 'obviously' an
> atomic operation - while 'fetch' could be anything.
We don't have xchg_*() naming, we have xchg() and that's about it. And
yes, people know xchg() is an atomic op. But 'fetch (and) or' is also
atomic, it has to be, it needs to do 2 operations in 1.
Furthermore, the relevant wikipedia page is:
https://en.wikipedia.org/wiki/Fetch-and-add
So the naming is widely established.
Powered by blists - more mailing lists