LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] LOCKDEP: minor fix for debug_show_all_locks()
@ 2008-10-27 20:03 sniper
2008-10-28 8:29 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: sniper @ 2008-10-27 20:03 UTC (permalink / raw)
To: mingo, peterz; +Cc: linux-kernel
When we failed to get tasklist_lock eventually (count equals 0),
we should only print " ignoring it.\n", and not print
" locked it.\n" needlessly.
Signed-off-by: Qinghuang Feng <qhfeng.kernel@gmail.com>
---
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index dbda475..12bf812 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -3417,10 +3417,12 @@ retry:
}
printk(" ignoring it.\n");
unlock = 0;
+ goto print_locks;
}
if (count != 10)
printk(" locked it.\n");
+print_locks:
do_each_thread(g, p) {
/*
* It's not reliable to print a task's held locks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] LOCKDEP: minor fix for debug_show_all_locks()
2008-10-27 20:03 [PATCH] LOCKDEP: minor fix for debug_show_all_locks() sniper
@ 2008-10-28 8:29 ` Ingo Molnar
2008-10-28 9:24 ` qinghuang feng
0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2008-10-28 8:29 UTC (permalink / raw)
To: sniper; +Cc: mingo, peterz, linux-kernel
* sniper <s3c24xx@gmail.com> wrote:
> When we failed to get tasklist_lock eventually (count equals 0),
> we should only print " ignoring it.\n", and not print
> " locked it.\n" needlessly.
well spotted!
Minor nit:
> --- a/kernel/lockdep.c
> +++ b/kernel/lockdep.c
> @@ -3417,10 +3417,12 @@ retry:
> }
> printk(" ignoring it.\n");
> unlock = 0;
> + goto print_locks;
> }
> if (count != 10)
> printk(" locked it.\n");
>
> +print_locks:
> do_each_thread(g, p) {
please move the "if (count != 10)" line into the else section of the
trylock, instead of introducing a label and a goto.
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] LOCKDEP: minor fix for debug_show_all_locks()
2008-10-28 8:29 ` Ingo Molnar
@ 2008-10-28 9:24 ` qinghuang feng
2008-10-28 9:31 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: qinghuang feng @ 2008-10-28 9:24 UTC (permalink / raw)
To: Ingo Molnar; +Cc: sniper, mingo, peterz, linux-kernel
When we failed to get tasklist_lock eventually (count equals 0),
we should only print " ignoring it.\n", and not print
" locked it.\n" needlessly.
Signed-off-by: Qinghuang Feng <qhfeng.kernel@gmail.com>
---
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index dbda475..6533fd9 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -3417,8 +3417,7 @@ retry:
}
printk(" ignoring it.\n");
unlock = 0;
- }
- if (count != 10)
+ } else if (count != 10)
printk(" locked it.\n");
do_each_thread(g, p) {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] LOCKDEP: minor fix for debug_show_all_locks()
2008-10-28 9:24 ` qinghuang feng
@ 2008-10-28 9:31 ` Ingo Molnar
0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2008-10-28 9:31 UTC (permalink / raw)
To: qinghuang feng; +Cc: sniper, mingo, peterz, linux-kernel
* qinghuang feng <qhfeng.kernel@gmail.com> wrote:
> When we failed to get tasklist_lock eventually (count equals 0),
> we should only print " ignoring it.\n", and not print
> " locked it.\n" needlessly.
>
> Signed-off-by: Qinghuang Feng <qhfeng.kernel@gmail.com>
> ---
> diff --git a/kernel/lockdep.c b/kernel/lockdep.c
> index dbda475..6533fd9 100644
> --- a/kernel/lockdep.c
> +++ b/kernel/lockdep.c
> @@ -3417,8 +3417,7 @@ retry:
> }
> printk(" ignoring it.\n");
> unlock = 0;
> - }
> - if (count != 10)
> + } else if (count != 10)
> printk(" locked it.\n");
>
applied to tip/core/urgent, thanks!
note that i've done two small tweaks to the patch:
- added curly braces to the else branch as well - the convention is
to mirror the curly braces of the main branch in such cases.
- added KERN_CONT for the printk
Ingo
-------------->
>From 46fec7ac40e452a2ea5e63648d98b6bb2b5898f9 Mon Sep 17 00:00:00 2001
From: qinghuang feng <qhfeng.kernel@gmail.com>
Date: Tue, 28 Oct 2008 17:24:28 +0800
Subject: [PATCH] lockdep: minor fix for debug_show_all_locks()
When we failed to get tasklist_lock eventually (count equals 0),
we should only print " ignoring it.\n", and not print
" locked it.\n" needlessly.
Signed-off-by: Qinghuang Feng <qhfeng.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/lockdep.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index dbda475..11832ac 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -3417,9 +3417,10 @@ retry:
}
printk(" ignoring it.\n");
unlock = 0;
+ } else {
+ if (count != 10)
+ printk(KERN_CONT " locked it.\n");
}
- if (count != 10)
- printk(" locked it.\n");
do_each_thread(g, p) {
/*
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-28 9:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-27 20:03 [PATCH] LOCKDEP: minor fix for debug_show_all_locks() sniper
2008-10-28 8:29 ` Ingo Molnar
2008-10-28 9:24 ` qinghuang feng
2008-10-28 9:31 ` Ingo Molnar
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).