lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160315105008.GT6344@twins.programming.kicks-ass.net>
Date:	Tue, 15 Mar 2016 11:50:08 +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 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.

I've even thought about reworking our entire atomic*_t bits to match.
That is, introduce all the fetch_$op primitives, then convert all the
$op_return ones over and finally remove all the $op_return ones.

I've not done so because we're all so very used to $op_return that I'm
sure people (and this would very much include me) would curse me for
changing this.

The reason for fetch_$op is that it also works for irreversible
operations like or. With or_return you simply cannot tell what the
previous state was (with add_return you can do a simple subtraction to
revert to the prior state).

And yes, some people use the xchg-$op naming, but its less widely used
(x86 asm being one). Other also use swap-$op.

In any case, I prefer the name as it was.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ