From: Mark Rutland <mark.rutland@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>,
Boqun Feng <boqun.feng@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Will Deacon <will.deacon@arm.com>, Arnd Bergmann <arnd@arndb.de>,
Richard Henderson <rth@twiddle.net>,
Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
Matt Turner <mattst88@gmail.com>,
Vineet Gupta <vgupta@synopsys.com>,
Russell King <linux@armlinux.org.uk>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Palmer Dabbelt <palmer@sifive.com>, Albert Ou <albert@sifive.com>
Subject: [PATCH 00/13] atomics: API cleanups
Date: Wed, 23 May 2018 14:35:20 +0100 [thread overview]
Message-ID: <20180523133533.1076-1-mark.rutland@arm.com> (raw)
This series contains a few cleanups of the atomic API, fixing an
inconsistency between atomic_* and atomic64_*, and minimizing repetition
in arch code. This is nicer for arch code, and the improved regularity
will help when generating the atomic headers in future.
The bulk of the patches reorganise things so architectures consistently
provide <atomic>_fetch_add_unless(), with atomic_fetch_add_unless()
provided as a wrapper by core code. A generic fallback is provided for
<atomic>_fetch_add_unless(), based on <atomic>_read() and
<atomic>_try_cmpxchg().
Other patches in the series add common fallbacks for:
* atomic64_inc_not_zero()
* <atomic>_inc_and_test()
* <atomic>_dec_and_test()
* <atomic>_sub_and_test()
* <atomic>add_negative()
... as almost all architectures provide identical implementation of
these today.
The end result is a strongly negative diffstat, though <linux/atomic.h>
grows by a reasonable amount. When we generate the headers, we can halve
this by templating the various fallbacks for atomic{,64}_t.
I've pushed this out to my atomics/api-cleanup branch [1] on kernel.org.
Thanks,
Mark.
[1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git atomics/api-cleanup
Mark Rutland (13):
atomics/treewide: s/__atomic_add_unless/atomic_fetch_add_unless/
atomics/treewide: remove redundant atomic_inc_not_zero() definitions
atomics/treewide: make atomic64_inc_not_zero() optional
atomics/treewide: make atomic_fetch_add_unless() optional
atomics: prepare for atomic64_fetch_add_unless()
atomics/generic: define atomic64_fetch_add_unless()
atomics/alpha: define atomic64_fetch_add_unless()
atomics/arc: define atomic64_fetch_add_unless()
atomics/arm: define atomic64_fetch_add_unless()
atomics/powerpc: define atomic64_fetch_add_unless()
atomics/riscv: define atomic64_fetch_add_unless()
atomics/treewide: make atomic64_fetch_add_unless() optional
atomics/treewide: make test ops optional
arch/alpha/include/asm/atomic.h | 43 +++----
arch/arc/include/asm/atomic.h | 66 ++--------
arch/arm/include/asm/atomic.h | 43 ++-----
arch/arm64/include/asm/atomic.h | 23 ----
arch/h8300/include/asm/atomic.h | 8 +-
arch/hexagon/include/asm/atomic.h | 12 +-
arch/ia64/include/asm/atomic.h | 56 ---------
arch/m68k/include/asm/atomic.h | 19 +--
arch/mips/include/asm/atomic.h | 134 --------------------
arch/openrisc/include/asm/atomic.h | 4 +-
arch/parisc/include/asm/atomic.h | 72 -----------
arch/powerpc/include/asm/atomic.h | 47 ++-----
arch/riscv/include/asm/atomic.h | 27 +---
arch/s390/include/asm/atomic.h | 40 ------
arch/sh/include/asm/atomic.h | 29 -----
arch/sparc/include/asm/atomic_32.h | 19 +--
arch/sparc/include/asm/atomic_64.h | 52 --------
arch/sparc/lib/atomic32.c | 4 +-
arch/x86/include/asm/atomic.h | 25 +---
arch/x86/include/asm/atomic64_32.h | 54 --------
arch/x86/include/asm/atomic64_64.h | 25 +---
arch/xtensa/include/asm/atomic.h | 66 ----------
drivers/block/rbd.c | 2 +-
drivers/infiniband/core/rdma_core.c | 2 +-
fs/afs/rxrpc.c | 2 +-
include/asm-generic/atomic-instrumented.h | 42 ++++++-
include/asm-generic/atomic.h | 20 ---
include/asm-generic/atomic64.h | 8 +-
include/linux/atomic.h | 198 +++++++++++++++++++++++++++++-
kernel/bpf/syscall.c | 4 +-
lib/atomic64.c | 13 +-
net/rxrpc/call_object.c | 2 +-
net/rxrpc/conn_object.c | 4 +-
net/rxrpc/local_object.c | 2 +-
net/rxrpc/peer_object.c | 2 +-
35 files changed, 329 insertions(+), 840 deletions(-)
--
2.11.0
next reply other threads:[~2018-05-23 13:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 13:35 Mark Rutland [this message]
2018-05-23 13:35 ` [PATCH 01/13] atomics/treewide: s/__atomic_add_unless/atomic_fetch_add_unless/ Mark Rutland
2018-05-23 14:01 ` Geert Uytterhoeven
2018-05-23 13:35 ` [PATCH 02/13] atomics/treewide: remove redundant atomic_inc_not_zero() definitions Mark Rutland
2018-05-24 8:26 ` Mark Rutland
2018-05-23 13:35 ` [PATCH 03/13] atomics/treewide: make atomic64_inc_not_zero() optional Mark Rutland
2018-05-23 13:35 ` [PATCH 04/13] atomics/treewide: make atomic_fetch_add_unless() optional Mark Rutland
2018-05-23 14:02 ` Geert Uytterhoeven
2018-05-23 13:35 ` [PATCH 05/13] atomics: prepare for atomic64_fetch_add_unless() Mark Rutland
2018-05-23 13:35 ` [PATCH 06/13] atomics/generic: define atomic64_fetch_add_unless() Mark Rutland
2018-05-23 13:35 ` [PATCH 07/13] atomics/alpha: " Mark Rutland
2018-05-23 13:35 ` [PATCH 08/13] atomics/arc: " Mark Rutland
2018-05-23 13:35 ` [PATCH 09/13] atomics/arm: " Mark Rutland
2018-05-23 13:35 ` [PATCH 10/13] atomics/powerpc: " Mark Rutland
2018-05-24 1:50 ` Michael Ellerman
2018-05-23 13:35 ` [PATCH 11/13] atomics/riscv: " Mark Rutland
2018-05-23 13:35 ` [PATCH 12/13] atomics/treewide: make atomic64_fetch_add_unless() optional Mark Rutland
2018-05-23 13:35 ` [PATCH 13/13] atomics/treewide: make test ops optional Mark Rutland
2018-05-23 14:03 ` Geert Uytterhoeven
2018-05-29 9:11 ` Mark Rutland
2018-05-29 9:57 ` Mark Rutland
2018-05-29 10:49 ` Peter Zijlstra
2018-05-23 17:18 ` [PATCH 00/13] atomics: API cleanups Peter Zijlstra
2018-05-24 8:27 ` Mark Rutland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180523133533.1076-1-mark.rutland@arm.com \
--to=mark.rutland@arm.com \
--cc=albert@sifive.com \
--cc=arnd@arndb.de \
--cc=benh@kernel.crashing.org \
--cc=boqun.feng@gmail.com \
--cc=ink@jurassic.park.msu.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mattst88@gmail.com \
--cc=mpe@ellerman.id.au \
--cc=palmer@sifive.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=rth@twiddle.net \
--cc=vgupta@synopsys.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®