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

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/

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