Re: [patch V3 5/7] rtmutex: Confine deadlock logic to futex

From: Lai Jiangshan
Date: Mon Jun 09 2014 - 23:59:16 EST


On 06/10/2014 08:59 AM, Steven Rostedt wrote:
> 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);
>> +}

This futex variant one is not used until next patch, it should not be
introduced in this patch.

>> +
>> /**
>> * 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:
>

It will use RT_MUTEX_*FULL*_CHAINWALK for the futex variant one while
rt_mutex_timed_lock() will use RT_MUTEX_*MIN*_CHAINWALK

>
> 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/