[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220209210824.wwsq63z4o6a6ei7a@offworld>
Date: Wed, 9 Feb 2022 13:08:24 -0800
From: Davidlohr Bueso <dave@...olabs.net>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Waiman Long <longman@...hat.com>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH REPOST] locking/local_lock: Make the empty local_lock_*()
function a macro.
On Tue, 08 Feb 2022, Sebastian Andrzej Siewior wrote:
>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@...utronix.de>
>Reviewed-by: Waiman Long <longman@...hat.com>
Reviewed-by: Davidlohr Bueso <dbueso@...e.de>
Powered by blists - more mailing lists