Re: [patch 3/6] rtmutex: Cleanup deadlock detector debug logic
From: Steven Rostedt
Date: Fri May 30 2014 - 18:08:58 EST
On Thu, 22 May 2014 03:25:47 -0000
Thomas Gleixner <tglx@xxxxxxxxxxxxx> 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);
>
--
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/