[PATCH v2 7/7] riscv: traps: mark do_irq() as __always_inline

Jisheng Zhang jszhang at kernel.org
Sat Jul 20 10:12:32 PDT 2024


Since do_irq() is only called in traps.c, so mark it as __always_inline
this will allow the compiler to get rid of the stack setup/tear down
code and eliminate a handful of instructions.

Signed-off-by: Jisheng Zhang <jszhang at kernel.org>
---
 arch/riscv/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
index dc1bc84cfe15..030c50cb4e78 100644
--- a/arch/riscv/kernel/traps.c
+++ b/arch/riscv/kernel/traps.c
@@ -378,7 +378,7 @@ static void noinstr handle_riscv_irq(struct pt_regs *regs)
 	irq_exit_rcu();
 }
 
-static void noinstr do_irq(struct pt_regs *regs)
+static __always_inline void do_irq(struct pt_regs *regs)
 {
 	irqentry_state_t state = irqentry_enter(regs);
 
-- 
2.43.0




More information about the linux-riscv mailing list