Messages in this thread | | | Date | Mon, 20 Jul 2015 11:44:04 -0700 | Subject | Re: [RFC][PATCH 00/13] percpu rwsem -v2 | From | Linus Torvalds <> |
| |
On Sun, Jul 19, 2015 at 10:53 PM, Daniel Wagner <wagi@monom.org> wrote: > > Turning them back into arch_spinlock_t gives almost the same numbers as > with spinlock_t. > > Then Peter suggested to change the code to > > preempt_disable(); > spin_unlock(); > preempt_enable_no_resched(); > > to verify if arch_spin_lock() is buggy and does not disable preemption > and we see a lock holder preemption on non virt setups.
Hmm. "arch_spin_lock()" isn't _supposed_ to disable preemption. The caller should do that (possibly by disabling interrupts). See include/linux/spinlock_api_smp.h for details.
But yes, that's a *very* subtle difference between "arch_spin_lock()" and "spin_lock()". The former doesn't do lockdep or other debugging and it doesn't disable preemption. So they are not interchangeable.
The current lglocks uses arch_spin_lock exactly because it does not *want* lockdep tracking (it does its own) and because it does its own preemption handling.
So saying "verify if arch_spin_lock() is buggy and does not disable preemption" is complete BS. If arch_spin_lock() were to disable preemption, _that_ would be a bug.
Linus
| |