• Ingo Molnar's avatar
    [PATCH] Don't busy-lock-loop in preemptable spinlocks · 8b0a7bd8
    Ingo Molnar authored
    Paul Mackerras points out that doing the _raw_spin_trylock each time
    through the loop will generate tons of unnecessary bus traffic.
    Instead, after we fail to get the lock we should poll it with simple
    loads until we see that it is clear and then retry the atomic op. 
    Assuming a reasonable cache design, the loads won't generate any bus
    traffic until another cpu writes to the cacheline containing the lock.
    
    Agreed.
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    8b0a7bd8
spinlock.c 7.64 KB