lkml.org 
[lkml]   [1998]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.077 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site