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]
Date:	Tue, 15 Mar 2016 14:26:23 +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 v2] atomic: Fix bugs in 'fetch_or()' and rename it to
 'xchg_or()'

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ