Messages in this thread | | | Date | Wed, 15 Jul 1998 20:09:26 +0400 | From | Savochkin Andrey Vladimirovich <> | Subject | Re: question about spinlocks on UP |
| |
On Wed, Jul 15, 1998 at 04:19:33PM +0200, Andi Kleen wrote: > Oliver Neukum <neukum@fachschaft.org.chemie.uni-muenchen.de> writes: > > > is the first parameter of spin_lock_irqsave relevant on UP ? > > In other words is > > > > #ifdef SMP > > spinlock_t lock_xxx ... > > #endif > > > > #ifdef SMP > > spin_lock_irqsave(&lock_xxx,flags); > > #else > > spin_lock_irqsave(NULL,flags); > > #endif > > > > without side effects and is that worth it ? > > I don't like declaring a global variable unnecessary. > > spinlocks are generally a nop on UP. Because they're macros you can > just write > > > #ifdef SMP > spinlock_t bla_lock; > #endif > > .... > > spin_lock_irqsave(&bla_lock, flags); > > The preprocessor will remove the &bla_lock in the UP case.
I would not recommend the technique for the common use. The similar code was a pain for me when I debugged deadlocks and turned on spinlock emulation on UP kernel :-)
I don't think that a certain number of spinlock_t variables are worth the time needed to fix all missing declarations when you decide to debug something.
Best wishes Andrey V. Savochkin
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html
| |