Re: [PATCH 1/19] MUTEX: Introduce simple mutex implementation

Christoph Hellwig
2005-12-14T12:17:39Z

On Wed, Dec 14, 2005 at 03:35:36AM -0800, Andrew Morton wrote:
>
> Could someone please remind me why we're even discussing this, given that
> mutex_down() is slightly more costly than current down(), and mutex_up() is
> appreciably more costly than current up()?

That's a good question. The new mutex implementation here is big regression
to what we have right now. What I had in mind when brainstorming something
like this would be to have a slow-path pure C semaphore implementation that
is cross-platform, and keep the current semaphore code as mutex. Once that
is done the mutex code could be optimized further because it doesn't need to
deal with the broader uses of the semaphore, and we could add lots of useful
debugging.

The current patchkit is far from that.

What might be more useful as a start is to implement a mutex type ontop
of the current semaphore that has lots of additional checks for the DEBUG
build so we have nice diagnostics. Once we have all users of mutex semantics
using that API we can change the underlying implementation to whatever we want.