ARM: 8742/1: Always use REFCOUNT_FULL
authorJinbum Park <jinb.park7@gmail.com>
Tue, 9 Jan 2018 23:54:37 +0000 (00:54 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Sun, 21 Jan 2018 15:32:26 +0000 (15:32 +0000)
commitb26d07a0f5568bec782072006f25bbaaed49fb2e
tree199e57b473e341babc189e3b3cc9beb018fa53dd
parenta5281feafd7b1e352c1472143dcbc05ba30cfb1c
ARM: 8742/1: Always use REFCOUNT_FULL

refcount_t overflow detection is implemented as two way.

1. REFCOUNT_FULL

- It means the full refcount_t implementation
  which has validation but is slightly slower.
- (fd25d19f6b8d ("locking/refcount:
  Create unchecked atomic_t implementation"))

2. ARCH_HAS_REFCOUNT

- refcount_t overflow detection can be optimized
  via an arch-dependent way.
- It is based on atomic_t infrastructure
  with some instruction added for detection.
- It is faster than REFCOUNT_FULL,
  as fast as unprotected atomic_t infrastructure.
- (7a46ec0e2f48 ("locking/refcounts, x86/asm:
  Implement fast refcount overflow protection"))

ARCH_HAS_REFCOUNT has implemented for x86,
not implemented for others.

In the case of arm64,
Will Deacon said he didn't want the specialized
"fast but technically incomplete" refcounting as seen with x86's.

But rather to set REFCOUNT_FULL by default
because no one could point to real-world performance impacts with
REFCOUNT_FULL vs unprotected atomic_t infrastructure.

This is the reason arm64 ended up enabling REFCOUNT_FULL.
(4adcec1164de ("arm64: Always use REFCOUNT_FULL"))

As with the decision of arm64,
arm can set REFCOUNT_FULL by default.

Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jinbum Park <jinb.park7@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/Kconfig