From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <peterz@infradead.org>,
Clark Williams <clark.williams@gmail.com>,
Gregory Haskins <ghaskins@novell.com>,
Linux-rt <linux-rt-users@vger.kernel.org>
Subject: [patch 5/7] rtmutex: remove uber optimization
Date: Fri, 19 Dec 2008 16:03:06 -0000 [thread overview]
Message-ID: <20081219155556.164412879@linutronix.de> (raw)
In-Reply-To: <20081219155504.735865178@linutronix.de>
[-- Attachment #1: rtmutex-remove-uber-optimization.patch --]
[-- Type: text/plain, Size: 2537 bytes --]
The adaptive spin patches introduced an overdesigned optimization for
the adaptive path. This avoidance of those code pathes is not worth
the extra conditionals and furthermore it is inconsistent in itself.
Remove it and use the same mechanism as the other lock pathes. That
way we have a consistent state manipulation scheme and less extra
cases.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/rtmutex.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
Index: linux-2.6.24/kernel/rtmutex.c
===================================================================
--- linux-2.6.24.orig/kernel/rtmutex.c
+++ linux-2.6.24/kernel/rtmutex.c
@@ -848,7 +848,6 @@ rt_spin_lock_slowlock(struct rt_mutex *l
struct rt_mutex_waiter waiter;
unsigned long saved_state, flags;
struct task_struct *orig_owner;
- int missed = 0;
debug_rt_mutex_init_waiter(&waiter);
waiter.task = NULL;
@@ -870,20 +869,15 @@ rt_spin_lock_slowlock(struct rt_mutex *l
* about original state TASK_INTERRUPTIBLE as well, as we
* could miss a wakeup_interruptible()
*/
- saved_state = current->state;
+ saved_state = rt_set_current_blocked_state(current->state);
for (;;) {
unsigned long saved_flags;
int saved_lock_depth = current->lock_depth;
/* Try to acquire the lock */
- if (do_try_to_take_rt_mutex(lock, STEAL_LATERAL)) {
- /* If we never blocked break out now */
- if (!missed)
- goto unlock;
+ if (do_try_to_take_rt_mutex(lock, STEAL_LATERAL))
break;
- }
- missed = 1;
/*
* waiter.task is NULL the first time we come here and
@@ -913,12 +907,6 @@ rt_spin_lock_slowlock(struct rt_mutex *l
if (adaptive_wait(&waiter, orig_owner)) {
put_task_struct(orig_owner);
- saved_state = rt_set_current_blocked_state(saved_state);
- /*
- * The xchg() in update_current() is an implicit
- * barrier which we rely upon to ensure current->state
- * is visible before we test waiter.task.
- */
if (waiter.task)
schedule_rt_mutex(lock);
} else
@@ -927,6 +915,7 @@ rt_spin_lock_slowlock(struct rt_mutex *l
spin_lock_irqsave(&lock->wait_lock, flags);
current->flags |= saved_flags;
current->lock_depth = saved_lock_depth;
+ saved_state = rt_set_current_blocked_state(saved_state);
}
rt_restore_current_state(saved_state);
@@ -945,7 +934,6 @@ rt_spin_lock_slowlock(struct rt_mutex *l
*/
fixup_rt_mutex_waiters(lock);
- unlock:
spin_unlock_irqrestore(&lock->wait_lock, flags);
debug_rt_mutex_free_waiter(&waiter);
--
next prev parent reply other threads:[~2008-12-19 16:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-19 16:02 [patch 0/7] 2.6.24.7-rt24 bugfixes Thomas Gleixner
2008-12-19 16:02 ` [patch 1/7] ftrace: fix task state printout Thomas Gleixner
2008-12-19 16:25 ` Frédéric Weisbecker
2008-12-19 21:36 ` Ingo Molnar
2008-12-19 21:40 ` Thomas Gleixner
2008-12-20 13:08 ` Frédéric Weisbecker
2008-12-19 16:02 ` [patch 2/7] sched: remove useless nointeractive state Thomas Gleixner
2008-12-19 16:02 ` [patch 3/7] rtmutex: remove unused variable Thomas Gleixner
2008-12-19 16:03 ` [patch 4/7] rtmutex: unify state manipulation Thomas Gleixner
2008-12-19 18:36 ` Steven Rostedt
2008-12-19 19:40 ` Thomas Gleixner
2008-12-19 16:03 ` Thomas Gleixner [this message]
2008-12-19 16:03 ` [patch 6/7] rtmutex: remove useless schedule enforcement Thomas Gleixner
2008-12-19 16:03 ` [patch 7/7] rtmutex: prevent missed wakeups Thomas Gleixner
2008-12-19 21:22 [patch 0/7] 2.6.24.7-rt24 bugfixes V2 Thomas Gleixner
2008-12-19 21:23 ` [patch 5/7] rtmutex: remove uber optimization Thomas Gleixner
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=20081219155556.164412879@linutronix.de \
--to=tglx@linutronix.de \
--cc=clark.williams@gmail.com \
--cc=ghaskins@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/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
all inboxes | Powered by JetHome®