Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757296AbYHOMTL (ORCPT ); Fri, 15 Aug 2008 08:19:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753353AbYHOMSz (ORCPT ); Fri, 15 Aug 2008 08:18:55 -0400 Received: from 75-130-108-43.dhcp.oxfr.ma.charter.com ([75.130.108.43]:53187 "EHLO dev.haskins.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753090AbYHOMSx (ORCPT ); Fri, 15 Aug 2008 08:18:53 -0400 From: Gregory Haskins Subject: [PATCH RT RFC v2 4/8] rtmutex: formally initialize the rt_mutex_waiters To: mingo@elte.hu, paulmck@linux.vnet.ibm.com, peterz@infradead.org, tglx@linutronix.de, rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, gregory.haskins@gmail.com, David.Holmes@sun.com Date: Fri, 15 Aug 2008 08:08:31 -0400 Message-ID: <20080815120831.24722.28346.stgit@dev.haskins.net> In-Reply-To: <20080815120722.24722.66516.stgit@dev.haskins.net> References: <20080815120722.24722.66516.stgit@dev.haskins.net> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2557 Lines: 87 We will be adding more logic to rt_mutex_waiters and therefore lets centralize the initialization to make this easier going forward. Signed-off-by: Gregory Haskins --- kernel/rtmutex.c | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-) diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c index 7d11380..12de859 100644 --- a/kernel/rtmutex.c +++ b/kernel/rtmutex.c @@ -805,6 +805,15 @@ static int adaptive_wait(struct rt_mutex_waiter *waiter, } #endif +static void init_waiter(struct rt_mutex_waiter *waiter) +{ + memset(waiter, 0, sizeof(*waiter)); + + debug_rt_mutex_init_waiter(waiter); + waiter->task = NULL; + waiter->write_lock = 0; +} + /* * Slow path lock function spin_lock style: this variant is very * careful not to miss any non-lock wakeups. @@ -823,9 +832,7 @@ rt_spin_lock_slowlock(struct rt_mutex *lock) struct task_struct *orig_owner; int missed = 0; - debug_rt_mutex_init_waiter(&waiter); - waiter.task = NULL; - waiter.write_lock = 0; + init_waiter(&waiter); spin_lock_irqsave(&lock->wait_lock, flags); init_lists(lock); @@ -1324,6 +1331,8 @@ rt_read_slowlock(struct rw_mutex *rwm, int mtx) int saved_lock_depth = -1; unsigned long saved_state = -1, state, flags; + init_waiter(&waiter); + spin_lock_irqsave(&mutex->wait_lock, flags); init_rw_lists(rwm); @@ -1335,10 +1344,6 @@ rt_read_slowlock(struct rw_mutex *rwm, int mtx) /* Owner is a writer (or a blocked writer). Block on the lock */ - debug_rt_mutex_init_waiter(&waiter); - waiter.task = NULL; - waiter.write_lock = 0; - if (mtx) { /* * We drop the BKL here before we go into the wait loop to avoid a @@ -1538,8 +1543,7 @@ rt_write_slowlock(struct rw_mutex *rwm, int mtx) int saved_lock_depth = -1; unsigned long flags, saved_state = -1, state; - debug_rt_mutex_init_waiter(&waiter); - waiter.task = NULL; + init_waiter(&waiter); /* we do PI different for writers that are blocked */ waiter.write_lock = 1; @@ -2270,9 +2274,7 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state, struct rt_mutex_waiter waiter; unsigned long flags; - debug_rt_mutex_init_waiter(&waiter); - waiter.task = NULL; - waiter.write_lock = 0; + init_waiter(&waiter); spin_lock_irqsave(&lock->wait_lock, flags); init_lists(lock); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/