[PATCH v2] arm64: kernel: implement fast refcount checking

Kees Cook keescook at chromium.org
Wed Jul 26 21:16:10 PDT 2017


On Wed, Jul 26, 2017 at 7:11 PM, Li Kun <hw.likun at huawei.com> wrote:
> @Kees, should we implement the add-from-zero case ? What do you think?

If it can be done efficiently, yes. In the x86 case, it would
basically change "lock inc" into a huge cmpxchg loop, and it almost
doubled the cycles for the operation. Since
refcount_inc()/refcount_dec_and_test() is the primary code pattern,
it's not a good idea to mess with performance on especially those.
This LKDTM series should provide a good perf target to compare
against:

https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/log/?h=lkdtm/refcount

-Kees

-- 
Kees Cook
Pixel Security



More information about the linux-arm-kernel mailing list