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

From: Linus Torvalds
Date: Wed Dec 14 2005 - 21:46:06 EST




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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/