Re: [patch 04/15] Generic Mutex Subsystem, add-atomic-call-func-x86_64.patch

From: Ingo Molnar
Date: Wed Dec 21 2005 - 01:20:32 EST



* Nick Piggin <nickpiggin@xxxxxxxxxxxx> wrote:

> >>Considering that on UP, the arm should not need to disable interrupts
> >>for this function (or has someone refuted Linus?), how about:
> >
> >Kernel preemption.
>
> preempt_disable() ?

please take a look at kernel/mutex.c, there's a define at the top of the
file:

// #define MUTEX_IRQ_SAFE

which, if off, makes the mutex code use preempt_disable() and
preempt_enable() to make it preemption-safe. If it's on, the mutex
implementation uses IRQ flags.

in my current tree i've already eliminated this define, and have
switched the code to use preempt_disable()/preempt_enable() exclusively,
because preempt_*() is equally fast on all platforms, while IRQ disable
costs vary largely. (and they are rarely faster than preempt_disable()).

my current tree also provides a mechanism for architectures to hand-code
the mutex lock and unlock fastpath, if they choose to do so. So i think
we can really stop the cycle counting.

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/