On Wed, May 27, 2026 at 06:18:44PM +0200, Peter Zijlstra wrote:
> On Tue, May 26, 2026 at 08:21:36AM -0700, Boqun Feng wrote:
> > Hi Peter,
> > 
> > This is a follow-up for Lyude's work [1]. After learning the current
> > preempt_count() usage and how ARM64 handle this, I came up with this
> > series that could resolve your feedback [2]. The basic idea is based on:
> > 
> > 1) preempt_count() previously already masks our NEED_RESCHED bit, so the
> >    effective bits is 31bits
> > 2) with a 64bit preempt count implementation (as in your PREEMPT_LONG
> >    proposal), the effective bits that record "whether we CAN preempt or
> >    not" still fit in 32bit (i.e. an int)
> > 
> > as a result, I don't think we need to change the existing
> > preempt_count() API, but rather keep "32bit vs 64bit" as an
> > implementation detail. This saves us the need to change the printk code
> > for preempt_count().
> 
> > 
> > v1: 
> > https://lore.kernel.org/rust-for-linux/[email protected]/
> > 
> > Changes since v1:
> > 
> > * Rename PREEMPT_COUNT_64BIT to HAS_SEPARATE_PREEMPT_RESCHED_BITS per
> >   Mark Rutland.
> 
> Blergh, so I really don't like that new name. It isn't that
> PREEMPT_RESCHED is separate, it really is a 64bit preempt count.
> 
> Shashiko has a few fits, but its mostly being stupid. Although I think
> it might be useful to perhaps put a WARN_ON_ONCE(in_nmi()) in
> local_interrupt_disable().

Yes, that's also what I'm thinking of, and also we need to check
local_softirq_pending() in local_interrupt_enable() I think, because now
HARDIRQ_DISABLE bits being non-zero means deferring softirq. (Shashiko
also reported this as well).

> 
> Anyway, I'll re-read things again tomorrow, but I suppose this will do.
> 

Thank you!

Regards,
Boqun

Reply via email to