Re: [patch 10/15] Generic Mutex Subsystem,mutex-migration-helper-core.patch

From: Steven Rostedt
Date: Mon Dec 19 2005 - 09:26:11 EST


On Mon, 2005-12-19 at 02:38 +0100, Ingo Molnar wrote:
> Index: linux/include/linux/mutex.h
> ===================================================================
> --- linux.orig/include/linux/mutex.h
> +++ linux/include/linux/mutex.h

Maybe this should be in its own mutex-debug.h file with a:

#ifndef __LIUNX_MUTEX_H
# error Do not include this file directly, use mutex.h
#endif


> @@ -99,4 +99,120 @@ extern int FASTCALL(mutex_trylock(struct
> extern void FASTCALL(mutex_unlock(struct mutex *lock));
> extern int FASTCALL(mutex_is_locked(struct mutex *lock));
>
> +/*
> + * Debugging variant of mutexes. The only difference is that they
> accept

Also, add a comment here that mutex_debug should NOT be used directly.
This may seem obvious, but new Linux kernel programmers may just be
scanning the code for what they would like to use and add it. At least
let them know (although it may seem obvious) that this is just a
temporary structure that will go away soon, and if they want to use
mutexes, then use mutex, and don't be tempted to have a mutex up/down.

OK, I'm watching out for the idiots, but since I'm one every so often, I
hope someone watches out for me ;-)

-- Steve

> + * the semaphore APIs too:
> + */
> +struct mutex_debug {
> + struct mutex lock;
> +};
> +
> +#define DEFINE_MUTEX_DEBUG(mutexname) \
> + struct mutex_debug mutexname = \
> + { .lock = __MUTEX_INITIALIZER(mutexname.lock) }
> +

-
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/