| From | Ankur Arora <> | Subject | [PATCH 08/30] entry: irqentry_exit only preempts for TIF_NEED_RESCHED | Date | Mon, 12 Feb 2024 21:55:32 -0800 |
| |
Use tif_need_resched(NR_now) instead of need_resched() to be explicit that this path only reschedules if it is needed imminently.
Also, add a comment about why we need a need-resched check here at all, given that the top level conditional already has checked the preempt_count().
Cc: Peter Zijlstra <peterz@infradead.org> Cc: Andy Lutomirski <luto@kernel.org> Originally-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/lkml/87jzshhexi.ffs@tglx/ Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com> --- kernel/entry/common.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/kernel/entry/common.c b/kernel/entry/common.c index 5c5befb05410..e1e6d7c92ca2 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -301,7 +301,15 @@ void raw_irqentry_exit_cond_resched(void) rcu_irq_exit_check_preempt(); if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) WARN_ON_ONCE(!on_thread_stack()); - if (need_resched()) + + /* + * Check if we need to preempt eagerly. + * + * Note we need an explicit check here because some archs don't + * fold TIF_NEED_RESCHED in the preempt_count. For archs that + * do, this is already covered in the conditinal above. + */ + if (tif_need_resched(NR_now)) preempt_schedule_irq(); } } -- 2.31.1
|