Re: [RFC RESEND v10 03/14] irq & spin_lock: Add counted interrupt disabling/enabling
From: Boqun Feng
Date: Tue Jun 17 2025 - 10:32:39 EST
On Tue, May 27, 2025 at 06:21:44PM -0400, Lyude Paul wrote:
[...]
> +/* No rwlock_t variants for now, so just build this function by hand */
> +static void __lockfunc __raw_spin_lock_irq_disable(raw_spinlock_t *lock)
> +{
> + for (;;) {
> + preempt_disable();
Lyude, You can remove the preempt_disable() and the following
preempt_enable(), since local_interrupt_disable() participates the
preempt count game as well.
Regards,
Boqun
> + local_interrupt_disable();
> + if (likely(do_raw_spin_trylock(lock)))
> + break;
> + local_interrupt_enable();
> + preempt_enable();
> +
> + arch_spin_relax(&lock->raw_lock);
> + }
> +}
> +
[...]