Messages in this thread | | | Subject | Re: [PATCH 1/19] MUTEX: Introduce simple mutex implementation | From | Alan Cox <> | Date | Tue, 13 Dec 2005 13:05:18 +0000 |
| |
On Llu, 2005-12-12 at 23:45 +0000, David Howells wrote: > (5) Redirects the following to apply to the new mutexes rather than the > traditional semaphores: > > down() > down_trylock() > down_interruptible() > up() > init_MUTEX() > init_MUTEX_LOCKED() > DECLARE_MUTEX() > DECLARE_MUTEX_LOCKED()
And you've audited every occurence ?
> On the basis that most usages of semaphores are as mutexes, this makes > sense for in most cases it's just then a matter of changing the type from > struct semaphore to struct mutex.
You propose to rename the existing up and down, which are counting semaphores, documented and used that way everywhere with mutexes which are not. Worse still up/down are, second to P/V, the usual forms of referring to _counting_ semaphores.
It seems to me it would be far far saner to define something like
sleep_lock(&foo) sleep_unlock(&foo) sleep_trylock(&foo)
given the new mutex interface is actually a sleeping interface with the semantics of the spin_lock interface. Its then obvious what it does, you don't randomly break other drivers you've not reviewed and the interface is intuitive rather than obfuscated.
It won't take long for people to then change the name of the performance critical cases and the others will catch up in time.
It also saves breaking every piece of out of tree kernel code for now good reason.
Alan
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |