Re: About a change to the implementation of spin lock in 2.6.12 kernel.

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

 



Your revised version has the disadvantage of not working.
Consider a lock word that's initially 1:

Task 1:		Task 2:		
                
cmpb $0,%0      cmpb $0,%0	Both see it as equal to 1
jle 2f          jle 2f		Both no NOT jump
movb $0, %0     movb $0, %0	Both overwrite it with zero.

When releasing a lock, there is no race condition because only one
task *has* the lock.  But when acquiring it, you need the (expensive0
atomic test-and-set to synchronize between different processors.
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux