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 3/6] rtmutex: Cleanup deadlock detector debug logic
On Thu, 22 May 2014 03:25:47 -0000
Thomas Gleixner <tglx@linutronix.de> wrote:


> Index: tip/kernel/locking/rtmutex.c
> ===================================================================
> --- tip.orig/kernel/locking/rtmutex.c
> +++ tip/kernel/locking/rtmutex.c
> @@ -256,6 +256,25 @@ static void rt_mutex_adjust_prio(struct
> }
>
> /*
> + * Deadlock detection is conditional:
> + *
> + * If CONFIG_DEBUG_RT_MUTEXES=n, deadlock detection is only conducted
> + * if the detect argument is != 0.

"if the detect argument is not RT_MUTEX_MIN_CHAINWALK."

We want to get rid of magic numbers right?

> + *
> + * If CONFIG_DEBUG_RT_MUTEXES=y, deadlock detection is always
> + * conducted independent of the detect argument.
> + *
> + * If the waiter argument is NULL this indicates the deboost path and
> + * deadlock detection is disabled independent of the detect argument
> + * and the config settings.
> + */
> +static int
> +rt_mutex_cond_detect_deadlock(struct rt_mutex_waiter *waiter, int detect)
> +{
> + return debug_rt_mutex_detect_deadlock(waiter, detect);
> +}
> +
> +/*


> /*
> + * Constants for rt mutex functions which have a selectable deadlock
> + * detection.
> + *
> + * RT_MUTEX_MIN_CHAINWALK: Stops the lock chain walk when there are
> + * no further PI adjustments to be made.
> + *
> + * RT_MUTEX_FULL_CHAINWALK: Invoke deadlock detection with a full
> + * walk of the lock chain.
> + */
> +enum {
> + RT_MUTEX_MIN_CHAINWALK,
> + RT_MUTEX_FULL_CHAINWALK,
> +};

Why not name this enum and instead of passing in int into the
functions, pass the enum in. That way, in the future, people looking at
this code can see what parameters are permitted.
-- Steve


> +
> +/*
> * PI-futex support (proxy locking functions, etc.):
> */
> extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock);
>



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