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

Andrew Morton
2005-12-15T20:18:17Z

Andrew Morton <akpm@osdl.org> wrote:
>
> David Howells <dhowells@redhat.com> wrote:
> >
> > So... Would you then object to an implementation of a mutex appearing in the
> > tree which semaphores that are being used as strict mutexes can be migrated
> > over to as the opportunity arises?
>
> That would be sane.
>

But not very.

Look at it from the POV of major architectures: there's no way the new
mutex code will be faster than down() and up(), so we're adding a bunch of
new tricky locking code which bloats the kernel and has to be understood
and debugged for no gain.

And I don't buy the debuggability argument really. It'd be pretty simple
to add debug code to the existing semaphore code to trap non-mutex usages.
Then go through the few valid non-mutex users and do:

#if debug
sem->this_is_not_a_mutex = 1;
#endif