summaryrefslogtreecommitdiff
path: root/arch/arm64/kernel/entry-common.c
diff options
context:
space:
mode:
authorJinjie Ruan <ruanjinjie@huawei.com>2025-08-15 11:06:29 +0800
committerWill Deacon <will@kernel.org>2025-09-11 15:55:34 +0100
commitc74c44c6ae207e196c4c31c4a243abb0811a5974 (patch)
tree9372efb3c4e9a697155ef846bf824f1b35161356 /arch/arm64/kernel/entry-common.c
parent77c1953946391e38c1e5120230f8df14f85219a7 (diff)
arm64: entry: Use preempt_count() and need_resched() helper
The generic entry code uses preempt_count() and need_resched() helpers to check if it should do preempt_schedule_irq(). Currently, arm64 use its own check logic, that is "READ_ONCE(current_thread_info()->preempt_count == 0", which is equivalent to "preempt_count() == 0 && need_resched()". In preparation for moving arm64 over to the generic entry code, use these helpers to replace arm64's own code and move it ahead. No functional changes. Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/arm64/kernel/entry-common.c')
-rw-r--r--arch/arm64/kernel/entry-common.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
index dd7903f371ad..1ba1d40fa6a7 100644
--- a/arch/arm64/kernel/entry-common.c
+++ b/arch/arm64/kernel/entry-common.c
@@ -300,14 +300,6 @@ static inline bool arm64_preempt_schedule_irq(void)
return false;
/*
- * Note: thread_info::preempt_count includes both thread_info::count
- * and thread_info::need_resched, and is not equivalent to
- * preempt_count().
- */
- if (READ_ONCE(current_thread_info()->preempt_count) != 0)
- return false;
-
- /*
* DAIF.DA are cleared at the start of IRQ/FIQ handling, and when GIC
* priority masking is used the GIC irqchip driver will clear DAIF.IF
* using gic_arch_enable_irqs() for normal IRQs. If anything is set in
@@ -701,8 +693,10 @@ static __always_inline void __el1_irq(struct pt_regs *regs,
do_interrupt_handler(regs, handler);
irq_exit_rcu();
- if (arm64_preempt_schedule_irq())
- preempt_schedule_irq();
+ if (!preempt_count() && need_resched()) {
+ if (arm64_preempt_schedule_irq())
+ preempt_schedule_irq();
+ }
exit_to_kernel_mode(regs, state);
}