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>
This commit is contained in:
committed by
Palmer Dabbelt
parent
8237c5243a
commit
37a7a2a10e
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user