diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2022-02-08 18:08:02 +0100 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2022-02-11 12:13:56 +0100 |
commit | 9983a9d577db415c41099a20a5637ab25dd3c240 (patch) | |
tree | d45ce6b145ecfbdda34fe388e1f17e26db3e4bbb /init | |
parent | atomics: Fix atomic64_{read_acquire,set_release} fallbacks (diff) | |
download | linux-9983a9d577db415c41099a20a5637ab25dd3c240.tar.xz linux-9983a9d577db415c41099a20a5637ab25dd3c240.zip |
locking/local_lock: Make the empty local_lock_*() function a macro.
It has been said that local_lock() does not add any overhead compared to
preempt_disable() in a !LOCKDEP configuration. A micro benchmark showed
an unexpected result which can be reduced to the fact that local_lock()
was not entirely optimized away.
In the !LOCKDEP configuration local_lock_acquire() is an empty static
inline function. On x86 the this_cpu_ptr() argument of that function is
fully evaluated leading to an additional mov+add instructions which are
not needed and not used.
Replace the static inline function with a macro. The typecheck() macro
ensures that the argument is of proper type while the resulting
disassembly shows no traces of this_cpu_ptr().
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Waiman Long <longman@redhat.com>
Link: https://lkml.kernel.org/r/YgKjciR60fZft2l4@linutronix.de
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions