Re: [PATCH v3 2/7] locking/pvqspinlock: Add pending bit support

From: Davidlohr Bueso
Date: Mon Jul 27 2015 - 15:39:24 EST


On Mon, 2015-07-27 at 13:30 -0400, Waiman Long wrote:
> The pending bit acts as a 1-slot waiting queue. So if the vCPU needs to
> fall back to regular queuing, it needs to clear the bit.

Right, that's what I thought. So you would also need to call
clear_pending() as soon as the trylock/pending loop hits zero. Or am I
missing something?

/*
* trylock || pending
*/
for (;;) {
...
if (loop--<= 0) {
clear_pending(lock);
goto queue;
}
}

Also, no need to check for negative loop, zero should be enough to
breakout.

Thanks,
Davidlohr

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/