Re: [patch 4/6] rtmutex: Confine deadlock logic to futex

From: Steven Rostedt
Date: Fri May 30 2014 - 22:07:11 EST


On Thu, 22 May 2014 03:25:50 -0000
Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:

> Index: tip/kernel/locking/rtmutex.c
> ===================================================================
> --- tip.orig/kernel/locking/rtmutex.c
> +++ tip/kernel/locking/rtmutex.c
> @@ -957,47 +957,53 @@ EXPORT_SYMBOL_GPL(rt_mutex_lock);
> /**
> * rt_mutex_lock_interruptible - lock a rt_mutex interruptible
> *
> - * @lock: the rt_mutex to be locked
> - * @detect_deadlock: deadlock detection on/off
> + * @lock: the rt_mutex to be locked
> *
> * Returns:
> - * 0 on success
> - * -EINTR when interrupted by a signal
> - * -EDEADLK when the lock would deadlock (when deadlock detection is on)
> + * 0 on success
> + * -EINTR when interrupted by a signal
> */
> -int __sched rt_mutex_lock_interruptible(struct rt_mutex *lock,
> - int detect_deadlock)
> +int __sched rt_mutex_lock_interruptible(struct rt_mutex *lock)
> {
> might_sleep();
>
> return rt_mutex_fastlock(lock, TASK_INTERRUPTIBLE,
> - detect_deadlock, rt_mutex_slowlock);
> + RT_MUTEX_MIN_CHAINWALK, rt_mutex_slowlock);


I noticed after this change, the only two callers of rt_mutex_fastlock()
only pass in RT_MUTEX_MIN_CHAINWALK. We could remove the passing of
detect_deadlock to that too, and simplify that function.

-- Steve


> }
> EXPORT_SYMBOL_GPL(rt_mutex_lock_interruptible);
>
> +/*
> + * Futex variant to allow full deadlock detection.
> + */
> +int __rt_mutex_timed_lock(struct rt_mutex *lock,
> + struct hrtimer_sleeper *timeout)
> +{
> + might_sleep();
> +
> + return rt_mutex_timed_fastlock(lock, TASK_INTERRUPTIBLE, timeout,
> + RT_MUTEX_FULL_CHAINWALK,
> + rt_mutex_slowlock);
> +}
> +
--
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/