From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965027AbcCPIEq (ORCPT ); Wed, 16 Mar 2016 04:04:46 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:37896 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933246AbcCPIEm (ORCPT ); Wed, 16 Mar 2016 04:04:42 -0400 Date: Wed, 16 Mar 2016 09:04:37 +0100 From: Ingo Molnar To: Peter Zijlstra Cc: Linus Torvalds , Linux Kernel Mailing List , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Thomas Gleixner , Andrew Morton Subject: Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to 'xchg_or()' Message-ID: <20160316080437.GA31133@gmail.com> References: <20160314123200.GA15971@gmail.com> <20160315093245.GA7943@gmail.com> <20160315122145.GA7225@gmail.com> <20160315132623.GZ6344@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160315132623.GZ6344@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Peter Zijlstra 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