Re: [patch 2/8] mutex subsystem, add asm-generic/mutex-[dec|xchg].h
implementations
[Posted January 3, 2006 by corbet]
| From: |
| Linus Torvalds <torvalds-AT-osdl.org> |
| To: |
| Ingo Molnar <mingo-AT-elte.hu> |
| Subject: |
| Re: [patch 2/8] mutex subsystem, add asm-generic/mutex-[dec|xchg].h
implementations |
| Date: |
| Thu, 22 Dec 2005 15:56:32 -0800 (PST) |
| Cc: |
| lkml <linux-kernel-AT-vger.kernel.org>, Andrew Morton <akpm-AT-osdl.org>,
Arjan van de Ven <arjanv-AT-infradead.org>,
Nicolas Pitre <nico-AT-cam.org>,
Jes Sorensen <jes-AT-trained-monkey.org>,
Zwane Mwaikambo <zwane-AT-arm.linux.org.uk>,
Oleg Nesterov <oleg-AT-tv-sign.ru>,
David Howells <dhowells-AT-redhat.com>,
Alan Cox <alan-AT-lxorguk.ukuu.org.uk>,
Benjamin LaHaise <bcrl-AT-kvack.org>,
Steven Rostedt <rostedt-AT-goodmis.org>,
Christoph Hellwig <hch-AT-infradead.org>, Andi Kleen <ak-AT-suse.de>,
Russell King <rmk+lkml-AT-arm.linux.org.uk> |
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