#define need_irq_preemption() (IS_ENABLED(CONFIG_PREEMPTION))
#endif
-static void __sched arm64_preempt_schedule_irq(void)
+static inline bool arm64_preempt_schedule_irq(void)
{
if (!need_irq_preemption())
- return;
+ return false;
/*
* Note: thread_info::preempt_count includes both thread_info::count
* preempt_count().
*/
if (READ_ONCE(current_thread_info()->preempt_count) != 0)
- return;
+ return false;
/*
* DAIF.DA are cleared at the start of IRQ/FIQ handling, and when GIC
* DAIF we must have handled an NMI, so skip preemption.
*/
if (system_uses_irq_prio_masking() && read_sysreg(daif))
- return;
+ return false;
/*
* Preempting a task from an IRQ means we leave copies of PSTATE
* Only allow a task to be preempted once cpufeatures have been
* enabled.
*/
- if (system_capabilities_finalized())
- preempt_schedule_irq();
+ if (!system_capabilities_finalized())
+ return false;
+
+ return true;
}
static void do_interrupt_handler(struct pt_regs *regs,
do_interrupt_handler(regs, handler);
irq_exit_rcu();
- arm64_preempt_schedule_irq();
+ if (arm64_preempt_schedule_irq())
+ preempt_schedule_irq();
exit_to_kernel_mode(regs, state);
}