lkml.org 
[lkml]   [2014]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch 4/6] rtmutex: Confine deadlock logic to futex
On Thu, 22 May 2014 03:25:50 -0000
Thomas Gleixner <tglx@linutronix.de> 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);
> +}
> +


\
 
 \ /
  Last update: 2014-05-31 05:01    [W:0.140 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site