Re: [RFC] Wine speedup through kernel module

From: David Howells (David.Howells@nexor.co.uk)
Date: Fri Sep 08 2000 - 02:25:48 EST


Horst von Brand <vonbrand@inf.utfsm.cl> wrote:
> Lost me there. If after releasing the mutex it is free, the release was
> sucessful AFAIAC. If two threads try to do it at the same time, so what?
> Releasing an already free mutex is broken, OK. But two threads owning the
> mutex at the same time is much worse...

Because the mutex release is done in two stages: (1) clear the state bit and
(2) set the owner pointer to NULL.

This is a sufficient window for a potential mutex grabber to jump in grab the
mutex and then have stage (2) clobber the owner pointer.

Anyway, I've changed this now (though I haven't got around to testing it yet):
On platforms that support cmpxchg(), it uses the owner pointer as the state
and exchanges it to NULL to release the mutex, and exchanges it to the owner
pointer when grabbing.

On platforms that don't, a spinlock is added to the WineMutex structure.

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



This archive was generated by hypermail 2b29 : Fri Sep 15 2000 - 21:00:10 EST