Re: Definition of spin_lock(lock) and spin_unlock(lock)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,

Halil Demirezen wrote:
 > in linux/spinlock.h the spinlocks are defined
 > and i want to know what kind of a reasonability does it have to define
 > spin_lock and spin_unlock in the following way.
 >
 >
 > #define spin_lock(lock) do {} while(0)
 > #define spin_unlock(lock) (void)...
 >

that's the definition for UP, not preemptible kernel (they don't need 
spinlock).
the real spinlock for SMP are defined (#ifdef CONFIG_SMP) in the 
architecture dependant headers (<asm/spinlock.h>).
if the kernel is preemptable (2.5 or patched) even uniprocessor machines 
have to care about race conditions so there's another #ifdef who add 
preempt lock stuff at the spinlock.

Gianluca



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux