Re: [patch v2 3/5] rtmutex: Confine deadlock logic to futex

From: Steven Rostedt
Date: Sat May 31 2014 - 15:54:45 EST


On Sat, 31 May 2014 15:57:50 -0000
Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:

> ===================================================================
> --- tip.orig/kernel/locking/rtmutex.c
> +++ tip/kernel/locking/rtmutex.c
> @@ -904,16 +904,15 @@ rt_mutex_slowunlock(struct rt_mutex *loc
> */
> static inline int
> rt_mutex_fastlock(struct rt_mutex *lock, int state,
> - enum rtmutex_chainwalk detect_deadlock,
> int (*slowfn)(struct rt_mutex *lock, int state,
> struct hrtimer_sleeper *timeout,
> enum rtmutex_chainwalk detect_deadlock))
> {
> - if (!detect_deadlock && likely(rt_mutex_cmpxchg(lock, NULL, current))) {
> + if (likely(rt_mutex_cmpxchg(lock, NULL, current))) {
> rt_mutex_deadlock_account_lock(lock, current);
> return 0;
> } else
> - return slowfn(lock, state, NULL, detect_deadlock);
> + return slowfn(lock, state, NULL, RT_MUTEX_MIN_CHAINWALK);
> }
>
> static inline int
> @@ -924,7 +923,7 @@ rt_mutex_timed_fastlock(struct rt_mutex
> struct hrtimer_sleeper *timeout,
> enum rtmutex_chainwalk detect_deadlock))
> {
> - if (!detect_deadlock && likely(rt_mutex_cmpxchg(lock, NULL, current))) {
> + if (detect_deadlock && likely(rt_mutex_cmpxchg(lock, NULL, current))) {

Did you mean to remove that "!"? Don't we want to call the slowfn all
the time if detect_deadlock is FULL?

-- Steve


> rt_mutex_deadlock_account_lock(lock, current);
> return 0;
> } else
> @@ -961,55 +960,59 @@ void __sched rt_mutex_lock(struct rt_mut
> {
> might_sleep();
>
> - rt_mutex_fastlock(lock, TASK_UNINTERRUPTIBLE, RT_MUTEX_MIN_CHAINWALK,
> - rt_mutex_slowlock);
> + rt_mutex_fastlock(lock, TASK_UNINTERRUPTIBLE, rt_mutex_slowlock);
> }
> EXPORT_SYMBOL_GPL(rt_mutex_lock);
--
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/