[PATCH] arm64: Avoid pointless schedule_preempt_irq() invocations

From: Thomas Gleixner
Date: Wed Jul 17 2019 - 04:44:04 EST


When preempt_count is zero on return from interrupt then
schedule_preempt_irq() is invoked even if TIF_NEED_RESCHED is not set.

That does not make sense because schedule_preempt_irq() has to go through a
full __schedule() for nothing in that case.

Check TIF_NEED_RESCHED and invoke schedule_preempt_irq() only if set.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
Found while staring at some RT wrecakge in that area.
---
arch/arm64/kernel/entry.S | 4 ++++
1 file changed, 4 insertions(+)

--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -680,6 +680,10 @@ alternative_if ARM64_HAS_IRQ_PRIO_MASKIN
orr x24, x24, x0
alternative_else_nop_endif
cbnz x24, 1f // preempt count != 0 || NMI return path
+
+ ldr x0, [tsk, #TSK_TI_FLAGS] // get flags
+ tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling?
+
bl preempt_schedule_irq // irq en/disable is done inside
1:
#endif