Re: question about spinlocks on UP

Andi Kleen (ak@muc.de)
15 Jul 1998 16:19:33 +0200


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.

-Andi

-
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