On Fri, 2010-12-24 at 10:26 -0800, Linus Torvalds wrote:
No numbers, the testcase I use for this series is too unstable to really
give that fine results. Its more a result of seeing the code an going:
"oohh that can wait a long time when the lock is severely contended".
But I think I can get rid of the need for calling this primitive
alltogether, which is even better.
I'm not sure I fully understand the complaint here. The ACCESS_ONCE is
for the tmp variable, which we use several times and needs to contain a
single load of the lock variable and should not be optimized away into
multiple loads.
The first conditional:
if (!(((tmp >> TICKET_SHIFT) ^ tmp) & TICKET_MASK))
Is exactly like the regular __ticket_spin_is_contended, and while that
is a somewhat overly clever way of writing head != tail, I don't see a
problem with that.
The second conditional:
while ((lock->slock & TICKET_MASK) == (tmp & TICKET_MASK))
Is indeed different, it waits for the lock tail (new load) to change
from the first observed (first load) tail. Once we observe the tail
index changing we know the previous owner completed and we can drop out.
Anyway, if I can indeed get rid of my unlock_wait usage its all moot
anyway, there aren't many users of this primitive.
--