kernel spinlocks

From: Michael Quinlivan (kmquin_at_optusnet.com.au)
Date: 07/31/03


Date: Fri, 01 Aug 2003 07:53:49 +1000

Hi all

Not sure if this is the right newsgroup for this question, if not please
direct me to appropriate one...

I am wanting to know how spinlocks are implemented in a non-SMP (ie
CONFIG_SMP not defined) kernel. Looking through the kernel source for
the type spinlock_t, I come across two conflicting definitions. One is
defined as a struct with a single int (include/asm/spinlock.h) and the
other as empty (include/linux/spinlock.h) There are similar situations
with macros such as spin_lock, spin_unlock, etc. One definition does
something, whereas the other seems to do nothing.

Can anyone allieve me of my confusion? Are spinlocks *real* on a
non-SMP x86 machine, or are they just no-ops? And if they are no-ops,
how can this work even on a uniprocessor machine (as you still have to
protect against interrupts)

Thanks for helping out a kernel newbie
Michael



Relevant Pages