Re: [PATCH/RFC] mutex: Fix optimistic spinning vs. BKL

From: Arnd Bergmann
Date: Wed Apr 28 2010 - 08:07:17 EST


On Wednesday 28 April 2010, Benjamin Herrenschmidt wrote:
> Now, we -could- make it a bit smarter about the BKL by introducing a
> contention counter and only go out if we own the BKL and it is contended,
> but I didn't feel like this was worth the effort, time is better spent
> removing the BKL from sensitive code path instead.

Agreed.

> - for (;;) {
> + for (timeout = jiffies + 2; jiffies < timeout;) {
> [...]
> - for (;;) {
> + while (jiffies < timeout) {

This needs to use time_before() to avoid problems on jiffies wraparound.

Arnd
--
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/