lkml.org 
[lkml]   [2014]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch v2 3/5] rtmutex: Confine deadlock logic to futex
On Sat, 31 May 2014 15:57:50 -0000
Thomas Gleixner <tglx@linutronix.de> 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);


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