UPSTREAM: arm64: restore get_current() optimisation
authorMark Rutland <mark.rutland@arm.com>
Tue, 3 Jan 2017 18:27:01 +0000 (18:27 +0000)
committerGreg Hackmann <ghackmann@google.com>
Tue, 24 Apr 2018 20:28:13 +0000 (13:28 -0700)
commit8c01d009ed72f4ca28e321d117410a6690d643d3
treebfb500e35fc065dd06ffef5bb183576eea1f5bb3
parent059e38f308c9ed2da84cb9d4cedef194b13cb395
UPSTREAM: arm64: restore get_current() optimisation

Commit c02433dd6de32f04 ("arm64: split thread_info from task stack")
inverted the relationship between get_current() and
current_thread_info(), with sp_el0 now holding the current task_struct
rather than the current thead_info. The new implementation of
get_current() prevents the compiler from being able to optimize repeated
calls to either, resulting in a noticeable penalty in some
microbenchmarks.

This patch restores the previous optimisation by implementing
get_current() in the same way as our old current_thread_info(), using a
non-volatile asm statement.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reported-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 9d84fb27fa135c99c9fe3de33628774a336a70a8)

Change-Id: Iaa615eeac18dd76b2e5c28673aac3bd0601878ab
Signed-off-by: Greg Hackmann <ghackmann@google.com>
arch/arm64/include/asm/current.h