* [PATCH] lockdep: do not count lock class operations without CONFIG_DEBUG_LOCKDEP
@ 2017-05-19 7:06 Konstantin Khlebnikov
2017-05-19 9:09 ` Peter Zijlstra
0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Khlebnikov @ 2017-05-19 7:06 UTC (permalink / raw)
To: linux-kernel; +Cc: Peter Zijlstra, Ingo Molnar
Currently this counter shown in /proc/lockdep if CONFIG_DEBUG_LOCKDEP=y
This patch disables it completely if this option is disabled.
This counter might be useful for debugging lockdep itself, but for normal
debugging it seems useless. Lockstat provides more detailed statistics.
This atomic_inc is a hot spot inside __lock_acquire() for debug kernel.
With patch "netperf -H localhost" shows some boost: 2500 -> 2600
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
kernel/locking/lockdep.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index c0e31bfee25c..60bd16984546 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -1375,7 +1375,9 @@ static void print_lock_class_header(struct lock_class *class, int depth)
printk("%*s->", depth, "");
print_lock_name(class);
+#ifdef CONFIG_DEBUG_LOCKDEP
printk(KERN_CONT " ops: %lu", class->ops);
+#endif
printk(KERN_CONT " {\n");
for (bit = 0; bit < LOCK_USAGE_STATES; bit++) {
@@ -3256,7 +3258,9 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
if (!class)
return 0;
}
+#ifdef CONFIG_DEBUG_LOCKDEP
atomic_inc((atomic_t *)&class->ops);
+#endif
if (very_verbose(class)) {
printk("\nacquire class [%p] %s", class->key, class->name);
if (class->name_version > 1)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] lockdep: do not count lock class operations without CONFIG_DEBUG_LOCKDEP
2017-05-19 7:06 [PATCH] lockdep: do not count lock class operations without CONFIG_DEBUG_LOCKDEP Konstantin Khlebnikov
@ 2017-05-19 9:09 ` Peter Zijlstra
2017-05-19 9:28 ` Konstantin Khlebnikov
0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2017-05-19 9:09 UTC (permalink / raw)
To: Konstantin Khlebnikov; +Cc: linux-kernel, Ingo Molnar
On Fri, May 19, 2017 at 10:06:01AM +0300, Konstantin Khlebnikov wrote:
> Currently this counter shown in /proc/lockdep if CONFIG_DEBUG_LOCKDEP=y
> This patch disables it completely if this option is disabled.
>
> This counter might be useful for debugging lockdep itself, but for normal
> debugging it seems useless. Lockstat provides more detailed statistics.
>
> This atomic_inc is a hot spot inside __lock_acquire() for debug kernel.
>
> With patch "netperf -H localhost" shows some boost: 2500 -> 2600
Nothing against these patches, but I do wonder why you're performance
optimizing debug kernels ;-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] lockdep: do not count lock class operations without CONFIG_DEBUG_LOCKDEP
2017-05-19 9:09 ` Peter Zijlstra
@ 2017-05-19 9:28 ` Konstantin Khlebnikov
0 siblings, 0 replies; 3+ messages in thread
From: Konstantin Khlebnikov @ 2017-05-19 9:28 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: linux-kernel, Ingo Molnar
On 19.05.2017 12:09, Peter Zijlstra wrote:
> On Fri, May 19, 2017 at 10:06:01AM +0300, Konstantin Khlebnikov wrote:
>> Currently this counter shown in /proc/lockdep if CONFIG_DEBUG_LOCKDEP=y
>> This patch disables it completely if this option is disabled.
>>
>> This counter might be useful for debugging lockdep itself, but for normal
>> debugging it seems useless. Lockstat provides more detailed statistics.
>>
>> This atomic_inc is a hot spot inside __lock_acquire() for debug kernel.
>>
>> With patch "netperf -H localhost" shows some boost: 2500 -> 2600
>
> Nothing against these patches, but I do wonder why you're performance
> optimizing debug kernels ;-)
>
Performance of debug features matters too
Obviously this saves time and money for massive testing
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-19 9:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-19 7:06 [PATCH] lockdep: do not count lock class operations without CONFIG_DEBUG_LOCKDEP Konstantin Khlebnikov
2017-05-19 9:09 ` Peter Zijlstra
2017-05-19 9:28 ` Konstantin Khlebnikov
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®