Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1358040

Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to 'xchg_or()'

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to 'xchg_or()'
Date 2016-03-15 14:30 +0100
Message-ID <rcXcT-2D2-19@gated-at.bofh.it> (permalink)
References <rczWV-3JY-15@gated-at.bofh.it> <rcNdw-49L-5@gated-at.bofh.it> <rcTCk-bX-35@gated-at.bofh.it> <rcWgP-21h-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL] NOHZ updates for v4.6 Ingo Molnar <mingo@kernel.org> - 2016-03-14 13:40 +0100
  Re: [GIT PULL] NOHZ updates for v4.6 Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-15 03:50 +0100
    Re: [GIT PULL] NOHZ updates for v4.6 Peter Zijlstra <peterz@infradead.org> - 2016-03-15 09:50 +0100
      Re: [GIT PULL] NOHZ updates for v4.6 Ingo Molnar <mingo@kernel.org> - 2016-03-15 10:50 +0100
    [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to 'xchg_or()' Ingo Molnar <mingo@kernel.org> - 2016-03-15 10:40 +0100
      Re: [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Peter Zijlstra <peterz@infradead.org> - 2016-03-15 12:00 +0100
        Re: [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Ingo Molnar <mingo@kernel.org> - 2016-03-15 13:10 +0100
          Re: [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Peter Zijlstra <peterz@infradead.org> - 2016-03-15 13:50 +0100
      Re: [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Peter Zijlstra <peterz@infradead.org> - 2016-03-15 12:10 +0100
      Re: [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Ingo Molnar <mingo@kernel.org> - 2016-03-15 13:10 +0100
        Re: [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Ingo Molnar <mingo@kernel.org> - 2016-03-15 13:40 +0100
          Re: [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Ingo Molnar <mingo@kernel.org> - 2016-03-15 13:40 +0100
          Re: [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Peter Zijlstra <peterz@infradead.org> - 2016-03-15 14:20 +0100
      Re: [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Peter Zijlstra <peterz@infradead.org> - 2016-03-15 13:30 +0100
      [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Ingo Molnar <mingo@kernel.org> - 2016-03-15 13:30 +0100
        Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Peter Zijlstra <peterz@infradead.org> - 2016-03-15 14:30 +0100
          Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Ingo Molnar <mingo@kernel.org> - 2016-03-16 09:10 +0100
            Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Peter Zijlstra <peterz@infradead.org> - 2016-03-16 09:40 +0100
        Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Frederic Weisbecker <fweisbec@gmail.com> - 2016-03-15 18:10 +0100
          Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Ingo Molnar <mingo@kernel.org> - 2016-03-16 09:20 +0100
            Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to  'xchg_or()' Frederic Weisbecker <fweisbec@gmail.com> - 2016-03-17 02:00 +0100
      Re: [PATCH] atomic: Fix bugs in 'fetch_or()' and rename it to 'xchg_or()' Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-15 17:20 +0100
    [PATCH] nohz: Change tick_dep_mask from 'unsigned long' to 'unsigned  int' Ingo Molnar <mingo@kernel.org> - 2016-03-15 11:00 +0100
      Re: [PATCH] nohz: Change tick_dep_mask from 'unsigned long' to  'unsigned int' Ingo Molnar <mingo@kernel.org> - 2016-03-15 13:20 +0100
        Re: [PATCH] nohz: Change tick_dep_mask from 'unsigned long' to  'unsigned int' Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-15 17:40 +0100
          Re: [PATCH] nohz: Change tick_dep_mask from 'unsigned long' to  'unsigned int' Frederic Weisbecker <fweisbec@gmail.com> - 2016-03-15 18:30 +0100
            Re: [PATCH] nohz: Change tick_dep_mask from 'unsigned long' to  'unsigned int' Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-15 18:40 +0100

csiph-web