Re: [PATCH][RFC]: mutex: adaptive spin

Pavel Machek
2009-01-10T17:53:11Z

> Linus, what do you think about this particular approach of spin-mutexes?
> It's not the typical spin-mutex i think.
>
> The thing i like most about Peter's patch (compared to most other adaptive
> spinning approaches i've seen, which all sucked as they included various
> ugly heuristics complicating the whole thing) is that it solves the "how
> long should we spin" question elegantly: we spin until the owner runs on a
> CPU.

Well; if there's a timeout, that's obviously safe.

But this has no timeout, and Linus wants to play games with accessing
'does owner run on cpu?' lockless. Now, can it mistakenly spin when
the owner is scheduled away? That would deadlock, and without locking,
I'm not sure if we prevent that....

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html