diff options
author | Jisheng Zhang <jszhang@kernel.org> | 2021-05-12 16:55:45 +0200 |
---|---|---|
committer | Palmer Dabbelt <palmerdabbelt@google.com> | 2021-05-26 07:56:57 +0200 |
commit | 37a7a2a10ec525a79d733008bc7fe4ebbca34382 (patch) | |
tree | c4d7257ecfe7a54eec0286b274de15ae56eb68a7 /arch/riscv/kernel/process.c | |
parent | riscv: Optimize switch_mm by passing "cpu" to flush_icache_deferred() (diff) | |
download | linux-37a7a2a10ec525a79d733008bc7fe4ebbca34382.tar.xz linux-37a7a2a10ec525a79d733008bc7fe4ebbca34382.zip |
riscv: Turn has_fpu into a static key if FPU=y
The has_fpu check sits at hot code path: switch_to(). Currently, has_fpu
is a bool variable if FPU=y, switch_to() checks it each time, we can
optimize out this check by turning the has_fpu into a static key.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/kernel/process.c')
-rw-r--r-- | arch/riscv/kernel/process.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c index f9cd57c9c67d..03ac3aa611f5 100644 --- a/arch/riscv/kernel/process.c +++ b/arch/riscv/kernel/process.c @@ -87,7 +87,7 @@ void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp) { regs->status = SR_PIE; - if (has_fpu) { + if (has_fpu()) { regs->status |= SR_FS_INITIAL; /* * Restore the initial value to the FP register |