lkml.org 
[lkml]   [2008]   [Feb]   [21]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
FromGregory Haskins <>
Subject[PATCH [RT] 11/14] optimize the !printk fastpath through the lock acquisition
DateThu, 21 Feb 2008 10:27:22 -0500
Decorate the printk path with an "unlikely()"

Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---
 kernel/rtmutex.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 122f143..ebdaa17 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -660,12 +660,12 @@ rt_spin_lock_fastlock(struct rt_mutex *lock,
 		void fastcall (*slowfn)(struct rt_mutex *lock))
 {
 	/* Temporary HACK! */
-	if (!current->in_printk)
-		might_sleep();
-	else if (in_atomic() || irqs_disabled())
+	if (unlikely(current->in_printk) && (in_atomic() || irqs_disabled()))
 		/* don't grab locks for printk in atomic */
 		return;
 
+	might_sleep();
+
 	if (likely(rt_mutex_cmpxchg(lock, NULL, current)))
 		rt_mutex_deadlock_account_lock(lock, current);
 	else
@@ -677,7 +677,7 @@ rt_spin_lock_fastunlock(struct rt_mutex *lock,
 			void fastcall (*slowfn)(struct rt_mutex *lock))
 {
 	/* Temporary HACK! */
-	if (current->in_printk && (in_atomic() || irqs_disabled()))
+	if (unlikely(current->in_printk) && (in_atomic() || irqs_disabled()))
 		/* don't grab locks for printk in atomic */
 		return;
 


\
 
 \ /
  Last update: 2008-02-21 17:03    [from the cache]
©2003-2008