Re: [RFC PATCH 3/5] x86,smp: auto tune spinlock backoff delay factor

From: Rik van Riel
Date: Fri Jan 04 2013 - 19:45:15 EST

On 01/03/2013 12:17 PM, Rik van Riel wrote:

+ if (!(head % 7) && delay < MAX_SPINLOCK_DELAY)
+ delay++;
+ loops = delay * waiters_ahead;

I don't like the head % 7 thing. I think using fixed point arithmetic
would be nicer:

delay += 256/7; /* Or whatever constant we choose */

loops = (delay * waiter_ahead) >> 8;

I'll do that. That could get completely rid of any artifacts
caused by incrementing sometimes, and not other times.

Also, we should probably skip the delay increment on the first loop
iteration - after all, we haven't waited yet, so we can't say that the
delay was too short.

Good point. I will do that.

I will build a kernel with the things you pointed out fixed,
and will give it a spin this afternoon.

Expect new patches soonish :)

After implementing all the ideas you came up with, which made
perfect sense to me, the code performs significantly worse
than before.


New patches will be coming ... later.

All rights reversed
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at