Re: [PATCH -v9][RFC] mutex: implement adaptive spinning

Linus Torvalds
2009-01-14T15:43:02Z

On Wed, 14 Jan 2009, Ingo Molnar wrote:

>
> * Chris Mason <chris.mason@oracle.com> wrote:
>
> > v10 is better that not spinning, but its in the 5-10% range. So, I've
> > been trying to find ways to close the gap, just to understand exactly
> > where it is different.
> >
> > If I take out:
> > /*
> > * If there are pending waiters, join them.
> > */
> > if (!list_empty(&lock->wait_list))
> > break;
> >
> >
> > v10 pops dbench 50 up to 1800MB/s. The other tests soundly beat my
> > spinning and aren't less fair. But clearly this isn't a good solution.
>
> i think since we already decided that it's ok to be somewhat unfair (_all_
> batching constructs introduce unfairness, so the question is never 'should
> we?' but 'by how much?'), we should just take this out and enjoy the speed

Yeah, let's just do it. It's going to be unfair, but let's see if the
unfairness is going to actually be noticeable in real life. I suspect it
isn't, and if it is, we can look at it again and see if there are other
approaches.

If it makes _that_ much of a difference on dbench, it's worth being unfair
even if it's just for some dubious benchmark.

Linus