Re: [patch 2/8] mutex subsystem, add asm-generic/mutex-[dec|xchg].himplementations

From: Linus Torvalds
Date: Thu Dec 22 2005 - 18:57:09 EST




On Fri, 23 Dec 2005, Ingo Molnar wrote:
>
> add the two generic mutex fastpath implementations.

Now this looks more like it. This is readable code without any #ifdef's in
the middle.

Now the only #ifdef's seem to be for mutex debugging. Might it be
worthwhile to have a generic debugging, that just uses spinlocks and just
accept that it's going to be slow, but shared across absolutely all
architectures?

Then you could have <linux/mutex.h> just doing a single

#ifdef CONFIG_MUTEX_DEBUG
# include <asm-generic/mutex-dbg.h>
#else
# include <asm/mutex.h>
#endif

and have muted-dbg.h just contain prototypes (no point in inlining them,
they're going to be big anyway) and then have a

obj$(CONFIG_MUTEX_DEBUG) += mutex-debug.c

in the kernel/ subdirectory? That way you could _really_ have a clean
separation, with absolutely zero pollution of any architecture mess or
debugging #ifdef's in any implementation code.

At that point I'd like to switch to mutexes just because the code is
cleaner!

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/