Re: [PATCH 13/24] irq: Optimize reschedule check in local_interrupt_enable()
Boqun Feng <[email protected]> Mon, 3 Aug 2026 10:09:43 -0700
| Newsgroups | org.kernel.vger.rust-for-linux,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Aug 03, 2026 at 01:41:28PM +0200, Peter Zijlstra wrote:
> On Fri, Jul 31, 2026 at 01:30:14PM -0700, Boqun Feng wrote:
> > In local_interrupt_enable(), we could avoid re-reading preempt count
> > because of should_resched() by using the result from
> > hardirq_disable_exit(), however this means __preempt_count_add_return()
> > and __preempt_count_sub_return() need to return all the preempt count
> > bits (including the PREEMPT_NEED_RESCHED bit), since the only user of
> > __preempt_count_{add,sub}_return() is hardirq_disable_{enter,exit}(),
> > hence make them return "unsigned long" to optimize this.
>
> > static inline void local_interrupt_enable(void)
> > {
> > - int new_count;
> > + unsigned long new_count;
> >
> > new_count = hardirq_disable_exit();
> >
> > @@ -52,15 +68,8 @@ static inline void local_interrupt_enable(void)
> >
> > flags = raw_cpu_read(local_interrupt_disable_state.flags);
> > local_irq_restore(flags);
> > - /*
> > - * TODO: re-read preempt count can be avoided, but it needs
> > - * should_resched() taking another parameter as the current
> > - * preempt count
> > - */
> > -#ifdef CONFIG_PREEMPTION
> > - if (should_resched(0))
> > - __preempt_schedule();
> > -#endif
> > +
> > + local_interrupt_enable_reched(new_count);
> > }
> > }
>
> As stated before; this whole thing is a mystery to me, this should not
> be needed.
I will drop this patch entirely per the discussion.
Regards,
Boqun