[lkml]   [2000]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC] Wine speedup through kernel module

Horst von Brand <> 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.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:41    [W:0.026 / U:1.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site