Re: [PATCH v2 00/12] Refcounted interrupt disable and SpinLockIrq for rust (Part 1)
Peter Zijlstra <[email protected]> Wed, 27 May 2026 18:18:44 +0200
| Newsgroups | org.kernel.vger.linux-openrisc,org.kernel.vger.bpf,org.kernel.vger.linux-arch,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kernel.vger.linux-s390,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
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(). Anyway, I'll re-read things again tomorrow, but I suppose this will do.