Re: [patch V3 5/7] rtmutex: Confine deadlock logic to futex
From: Steven Rostedt
Date: Mon Jun 09 2014 - 20:59:16 EST
On Mon, 09 Jun 2014 20:28:09 -0000
Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> +/*
> + * 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, 0,
> + rt_mutex_slowlock);
> +}
> +
> /**
> * rt_mutex_timed_lock - lock a rt_mutex interruptible
> * the timeout structure is provided
> * by the caller
> *
> - * @lock: the rt_mutex to be locked
> + * @lock: the rt_mutex to be locked
> * @timeout: timeout structure or NULL (no timeout)
> - * @detect_deadlock: deadlock detection on/off
> *
> * Returns:
> - * 0 on success
> - * -EINTR when interrupted by a signal
> + * 0 on success
> + * -EINTR when interrupted by a signal
> * -ETIMEDOUT when the timeout expired
> - * -EDEADLK when the lock would deadlock (when deadlock detection is on)
> */
> int
> -rt_mutex_timed_lock(struct rt_mutex *lock, struct hrtimer_sleeper *timeout,
> - int detect_deadlock)
> +rt_mutex_timed_lock(struct rt_mutex *lock, struct hrtimer_sleeper *timeout)
> {
> might_sleep();
>
> - return rt_mutex_timed_fastlock(lock, TASK_INTERRUPTIBLE, timeout,
> - detect_deadlock, rt_mutex_slowlock);
> + return rt_mutex_timed_fastlock(lock, TASK_INTERRUPTIBLE, timeout, 0,
> + rt_mutex_slowlock);
> }
> EXPORT_SYMBOL_GPL(rt_mutex_timed_lock);
>
I must be missing something. What's the difference between the above
and the futex variant one? They both do the exact same thing:
int foo(struct rt_mutex *lock, struct hrtimer_sleeper *timeout)
{
might_sleep();
return rt_mutex_timed_fastlock(lock, TASK_INTERRUPTIBLE, timout,
0, rt_mutex_slowlock);
}
??
-- Steve
--
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/