The TIF_NEED_RESCHED bit is inlined on x86 into the preemption counter. By using should_resched(0) instead of need_resched() the same check can be performed which uses the same variable as 'preempt_count()` which was issued before.
Use should_resched(0) instead need_resched(). Signed-off-by: Sebastian Andrzej Siewior <[email protected]> --- v1…v2: Use should_resched() but keep the !preempt_count() check. arch/x86/entry/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index bd3f14175193c..0bb6966f62738 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -615,11 +615,11 @@ static void idtentry_exit_cond_resched(struct pt_regs *regs, bool may_sched) if (may_sched && !preempt_count()) { /* Sanity check RCU and thread stack */ rcu_irq_exit_check_preempt(); if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) WARN_ON_ONCE(!on_thread_stack()); - if (need_resched()) + if (should_resched(0)) preempt_schedule_irq(); } /* Covers both tracing and lockdep */ trace_hardirqs_on(); } -- 2.27.0

