[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160314131621.GX6356@twins.programming.kicks-ass.net>
Date: Mon, 14 Mar 2016 14:16:21 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Davidlohr Bueso <dave@...olabs.net>
Cc: tglx@...utronix.de, mingo@...nel.org, bigeasy@...utronix.de,
umgwanakikbuti@...il.com, paulmck@...ux.vnet.ibm.com,
linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH 2/3] rtmutex: Add rt_mutex_init_waiter helper
On Tue, Mar 08, 2016 at 10:20:22AM -0800, Davidlohr Bueso wrote:
> +++ b/kernel/futex.c
> @@ -2778,10 +2778,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
> * The waiter is allocated on our stack, manipulated by the requeue
> * code while we sleep on uaddr.
> */
> - debug_rt_mutex_init_waiter(&rt_waiter);
> - RB_CLEAR_NODE(&rt_waiter.pi_tree_entry);
> - RB_CLEAR_NODE(&rt_waiter.tree_entry);
> - rt_waiter.task = NULL;
> + rt_mutex_init_waiter(&rt_waiter);
>
> ret = get_futex_key(uaddr2, flags & FLAGS_SHARED, &key2, VERIFY_WRITE);
> if (unlikely(ret != 0))
> +static inline void
> +rt_mutex_init_waiter(struct rt_mutex_waiter *waiter)
> +{
> + debug_rt_mutex_init_waiter(waiter);
> +
> + RB_CLEAR_NODE(&waiter->pi_tree_entry);
> + RB_CLEAR_NODE(&waiter->tree_entry);
> + waiter->task = NULL;
> +}
Just thinking, would not something like:
#define DEFINE_RT_WAITER(name) \
struct rt_mutex_waiter name = { \
.tree_entry = __INIT_RB_NODE(name.tree_entry), \
.pi_tree_entry = __INIT_RB_NODE(name.pi_tree_entry), \
__INIT_RT_WAITER_DEBUG(name) \
}
Be nicer? That way we're sure the whole structure is initialized.
Powered by blists - more mailing lists