On Thu, Dec 19, 2013 at 3:53 PM, Linus Torvalds <torva...@linux-foundation.org> wrote: > > So how could we miss this? Explain to me what the separate counter > does that isn't done by the spinlock head counter.
Hmm. Trying to answer this myself by looking at the code. And I just realized that I described things wrong ("spin_contended()" rather than "spin_is_locked()"). So that was a bug in my description. One difference is that by avoiding the counter, the "do we have waiters" is two values rather than one ("is spin locked" + "node list head is empty"). So there are possible memory ordering issues wrt reading those two fields, but I don't see it mattering: since you'd need to read both "not locked" _and_ "list empty", any re-ordering that shows both of those cases should be able to show the "waiters == 0" case in the explicit separate counter model. I don't know why I care, though. For some reason that extra counter just makes me go "I'm convinced it's not needed", even though I can't really explain why I should care about it. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/