asm-generic/atomic: Use __always_inline for pure wrappers
authorMarco Elver <elver@google.com>
Tue, 26 Nov 2019 14:04:04 +0000 (15:04 +0100)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 7 Jan 2020 15:47:23 +0000 (07:47 -0800)
commitc020395b6634b7a674ee6aa91a971b08e268caba
treedb44c013fbf40300d9104b0a70045144854390b4
parentd47715f50e833f12c5e829ce9dcc4a65104fa74f
asm-generic/atomic: Use __always_inline for pure wrappers

Prefer __always_inline for atomic wrappers. When building for size
(CC_OPTIMIZE_FOR_SIZE), some compilers appear to be less inclined to
inline even relatively small static inline functions that are assumed to
be inlinable such as atomic ops. This can cause problems, for example in
UACCESS regions.

By using __always_inline, we let the real implementation and not the
wrapper determine the final inlining preference.

For x86 tinyconfig we observe:
- vmlinux baseline: 1316204
- vmlinux with patch: 1315988 (-216 bytes)

This came up when addressing UACCESS warnings with CC_OPTIMIZE_FOR_SIZE
in the KCSAN runtime:
http://lkml.kernel.org/r/58708908-84a0-0a81-a836-ad97e33dbb62@infradead.org

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Marco Elver <elver@google.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
include/asm-generic/atomic-instrumented.h
include/asm-generic/atomic-long.h
scripts/atomic/gen-atomic-instrumented.sh
scripts/atomic/gen-atomic-long.sh