Re: [PATCH] mutex: enable spinning for DEBUG_MUTEX
From: Ingo Molnar
Date: Thu Feb 19 2009 - 06:22:27 EST
* Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> Subject: mutex: enable spinning for DEBUG_MUTEX
> From: Johannes Weiner <hannes@xxxxxxxxxxx>
> Date: Thu, 15 Jan 2009 15:57:38 +0100
>
> Spinning with CONFIG_DEBUG_MUTEX is possible but care must be taken
> with the debug checks vs. racy access to the lock owner field.
>
> In the case where the lock owner gets rescheduled after acquisition
> and therefor unlocks on another CPU, that second CPU might not see the
> write of the owner field from the first CPU and we warn about owner
> mismatch. Thus the memory barriers for the debug case.
>
> Also remove the redundant mutex_set_owner()s in __mutex_lock_common()
> and __mutex_trylock_slowpath(), it's taken care of in mutex_lock() and
> mutex_trylock().
>
> [a.p.zijlstra@xxxxxxxxx: fix _nested variants]
> Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> ---
> kernel/mutex-debug.c | 6 ++++++
> kernel/mutex-debug.h | 6 ++++++
> kernel/mutex.c | 27 +++++++++++++++------------
> 3 files changed, 27 insertions(+), 12 deletions(-)
Applied to tip:core/locking, thanks Peter!
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/