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

From: Ingo Molnar
Date: Fri Dec 23 2005 - 02:45:46 EST



* Linus Torvalds <torvalds@xxxxxxxx> wrote:

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

yeah, that's how it's working right now - the debugging variant still
includes the arch header, but ignores it, and always does the slowpath.
That's one of the advantages of the arch defining the fastpath, but not
the API! Debugging needs to set up more state so it needs the spinlock
all the time.

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

i think we are quite close to this already. We still want to share the
slowpath because we want to debug it. I'll try to put the mutex-debug.c
functions into a separate object file, but that introduces more
interfaces between the two than i wanted to - even if debugging is slow,
mutexes with full debugging are still faster in the VFS test than
semaphores ;) I also wanted to introduce a lighter mode of debugging
that could have the fastpath enabled, and which distributions could
enable by default in their QA phase. (just like SPINLOCK_DEBUG)

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