Skip to contentSkip to conversation

rt_mutex: don't initialize lockdep when not required

PATCH New Levin, Alexander (Sasha Levin) 2 participants 2 messages Jun 18, 2017 – Jun 20, 2017 Locking primitives

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rt_mutex: don't initialize lockdep when not required

pi_mutex isn't supposed to be tracked by lockdep, but just passing NULLs for name and key will cause lockdep to spew a warning and die, which is not what we want it to do.

Skip lockdep initialization if the caller passed NULLs for name and key, suggesting such initialization isn't desired.

Fixes f5694788ad8d ("rt_mutex: Add lockdep annotations")
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
---
 kernel/locking/rtmutex.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/locking/rtmutex.c +2 -1
index 43123533e9b1..78069895032a 100644
@@ -1661,7 +1661,8 @@ void __rt_mutex_init(struct rt_mutex *lock, const char *name,
 	lock->waiters = RB_ROOT;
 	lock->waiters_leftmost = NULL;
 
-	debug_rt_mutex_init(lock, name, key);
+	if (name && key)
+		debug_rt_mutex_init(lock, name, key);
 }
 EXPORT_SYMBOL_GPL(__rt_mutex_init);
 
Signature · 1 line
2.11.0
#1 lore raw

[tip:locking/core] locking/rtmutex: Don't initialize lockdep when not required

locking/rtmutex: Don't initialize lockdep when not required
Commit-ID:  cde50a67397c0da7d11795d4b4418384022ab8e6
Gitweb:     http://git.kernel.org/tip/cde50a67397c0da7d11795d4b4418384022ab8e6
Author:     Levin, Alexander (Sasha Levin) <[email protected]>
AuthorDate: Sun, 18 Jun 2017 14:06:01 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 20 Jun 2017 11:53:09 +0200

locking/rtmutex: Don't initialize lockdep when not required

pi_mutex isn't supposed to be tracked by lockdep, but just passing NULLs for name and key will cause lockdep to spew a warning and die, which is not what we want it to do.

Skip lockdep initialization if the caller passed NULLs for name and key, suggesting such initialization isn't desired.

Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes f5694788ad8d ("rt_mutex: Add lockdep annotations")
---
 kernel/locking/rtmutex.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/locking/rtmutex.c +2 -1
index 4312353..7806989 100644
@@ -1661,7 +1661,8 @@ void __rt_mutex_init(struct rt_mutex *lock, const char *name,
 	lock->waiters = RB_ROOT;
 	lock->waiters_leftmost = NULL;
 
-	debug_rt_mutex_init(lock, name, key);
+	if (name && key)
+		debug_rt_mutex_init(lock, name, key);
 }
 EXPORT_SYMBOL_GPL(__rt_mutex_init);