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

Linus Torvalds
2005-12-15T02:46:10Z

On Thu, 15 Dec 2005, Thomas Gleixner wrote:
>
> Well, depends on the POV. A counting sempahore is a different beast than
> a mutex. At least as far as my limited knowledge of concurrency controls
> goes.

A real semaphore is counting.

Dammit, unless the pure mutex has a _huge_ performance advantage on major
architectures, we're not changing it. There's absolutely zero point. A
counting semaphore is a perfectly fine mutex - the fact that it can _also_
be used to allow more than 1 user into a critical region and generally do
other things is totally immaterial.

It's _extra_ stupid to re-use the names "down()" and "up()" on a
non-counting mutex, since then the names make zero sense at all. Use
"lock_mutex()" and "unlock_mutex()" or something, and don't break existing
code for no measurable gain.

Linus