From: Gregory Haskins <ghaskins@novell.com>
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,
jkacur@gmail.com
Subject: [PATCH RT RFC v4 4/8] rtmutex: formally initialize the rt_mutex_waiters
Date: Fri, 15 Aug 2008 16:28:39 -0400 [thread overview]
Message-ID: <20080815202839.668.70080.stgit@dev.haskins.net> (raw)
In-Reply-To: <20080815202408.668.23736.stgit@dev.haskins.net>
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 <ghaskins@novell.com>
---
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);
next prev parent reply other threads:[~2008-08-15 20:30 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-01 21:16 [PATCH RT RFC 0/7] Priority Inheritance enhancements Gregory Haskins
2008-08-01 21:16 ` [PATCH RT RFC 1/7] add generalized priority-inheritance interface Gregory Haskins
2008-08-01 21:16 ` [PATCH RT RFC 2/7] sched: add the basic PI infrastructure to the task_struct Gregory Haskins
2008-08-01 21:17 ` [PATCH RT RFC 3/7] rtmutex: formally initialize the rt_mutex_waiters Gregory Haskins
2008-08-01 21:17 ` [PATCH RT RFC 4/7] RT: wrap the rt_rwlock "add reader" logic Gregory Haskins
2008-08-01 21:17 ` [PATCH RT RFC 5/7] rtmutex: use runtime init for rtmutexes Gregory Haskins
2008-08-01 21:17 ` [PATCH RT RFC 6/7] rtmutex: convert rtmutexes to fully use the PI library Gregory Haskins
2008-08-01 21:17 ` [PATCH RT RFC 7/7] rtmutex: pi-boost locks as late as possible Gregory Haskins
2008-08-04 13:21 ` Gregory Haskins
2008-08-05 3:01 ` Gregory Haskins
2008-08-15 12:08 ` [PATCH RT RFC v2 0/8] Priority Inheritance enhancements Gregory Haskins
2008-08-15 12:08 ` [PATCH RT RFC v2 1/8] add generalized priority-inheritance interface Gregory Haskins
2008-08-15 13:16 ` [PATCH RT RFC v3] " Gregory Haskins
2008-08-15 12:08 ` [PATCH RT RFC v2 2/8] sched: add the basic PI infrastructure to the task_struct Gregory Haskins
2008-08-15 12:08 ` [PATCH RT RFC v2 3/8] sched: rework task reference counting to work with the pi infrastructure Gregory Haskins
2008-08-15 12:08 ` [PATCH RT RFC v2 4/8] rtmutex: formally initialize the rt_mutex_waiters Gregory Haskins
2008-08-15 12:08 ` [PATCH RT RFC v2 5/8] RT: wrap the rt_rwlock "add reader" logic Gregory Haskins
2008-08-15 12:08 ` [PATCH RT RFC v2 6/8] rtmutex: use runtime init for rtmutexes Gregory Haskins
2008-08-15 12:08 ` [PATCH RT RFC v2 7/8] rtmutex: convert rtmutexes to fully use the PI library Gregory Haskins
2008-08-15 12:08 ` [PATCH RT RFC v2 8/8] rtmutex: pi-boost locks as late as possible Gregory Haskins
2008-08-15 20:28 ` [PATCH RT RFC v4 0/8] Priority Inheritance enhancements Gregory Haskins
2008-08-15 20:28 ` [PATCH RT RFC v4 1/8] add generalized priority-inheritance interface Gregory Haskins
2008-08-15 20:32 ` Gregory Haskins
2008-08-16 15:32 ` AW: " Matthias Behr
2008-08-19 8:34 ` Gregory Haskins
2008-08-16 19:56 ` Peter Zijlstra
2008-08-19 8:40 ` Gregory Haskins
2008-08-22 12:55 ` Esben Nielsen
2008-08-22 13:15 ` Gregory Haskins
2008-08-22 16:08 ` Gregory Haskins
2008-08-22 13:17 ` Steven Rostedt
2008-08-15 20:28 ` [PATCH RT RFC v4 2/8] sched: add the basic PI infrastructure to the task_struct Gregory Haskins
2008-08-15 20:28 ` [PATCH RT RFC v4 3/8] sched: rework task reference counting to work with the pi infrastructure Gregory Haskins
2008-08-15 20:28 ` Gregory Haskins [this message]
2008-08-15 20:28 ` [PATCH RT RFC v4 5/8] RT: wrap the rt_rwlock "add reader" logic Gregory Haskins
2008-08-15 20:28 ` [PATCH RT RFC v4 6/8] rtmutex: use runtime init for rtmutexes Gregory Haskins
2008-08-15 20:28 ` [PATCH RT RFC v4 7/8] rtmutex: convert rtmutexes to fully use the PI library Gregory Haskins
2008-08-15 20:29 ` [PATCH RT RFC v4 8/8] rtmutex: pi-boost locks as late as possible Gregory Haskins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080815202839.668.70080.stgit@dev.haskins.net \
--to=ghaskins@novell.com \
--cc=David.Holmes@sun.com \
--cc=gregory.haskins@gmail.com \
--cc=jkacur@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).