diff options
author | Bart Van Assche <bvanassche@acm.org> | 2019-07-22 11:24:43 -0700 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-07-25 15:43:28 +0200 |
commit | 8c779229d0f4fe83ead90bdcbbf08b02989aa200 (patch) | |
tree | 2a9d6239c74f3889ec46a4ea0037d32d8dd41505 /kernel/locking/lockdep.c | |
parent | 12593b7467f9130b64a6d4b6a26ed4ec217b6784 (diff) | |
download | linux-stable-8c779229d0f4fe83ead90bdcbbf08b02989aa200.tar.gz linux-stable-8c779229d0f4fe83ead90bdcbbf08b02989aa200.tar.bz2 linux-stable-8c779229d0f4fe83ead90bdcbbf08b02989aa200.zip |
locking/lockdep: Report more stack trace statistics
Report the number of stack traces and the number of stack trace hash
chains. These two numbers are useful because these allow to estimate
the number of stack trace hash collisions.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Waiman Long <longman@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Link: https://lkml.kernel.org/r/20190722182443.216015-5-bvanassche@acm.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/locking/lockdep.c')
-rw-r--r-- | kernel/locking/lockdep.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 1a96869cb2f0..3c3902c40a0e 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -516,6 +516,35 @@ static struct lock_trace *save_trace(void) return trace; } + +/* Return the number of stack traces in the stack_trace[] array. */ +u64 lockdep_stack_trace_count(void) +{ + struct lock_trace *trace; + u64 c = 0; + int i; + + for (i = 0; i < ARRAY_SIZE(stack_trace_hash); i++) { + hlist_for_each_entry(trace, &stack_trace_hash[i], hash_entry) { + c++; + } + } + + return c; +} + +/* Return the number of stack hash chains that have at least one stack trace. */ +u64 lockdep_stack_hash_count(void) +{ + u64 c = 0; + int i; + + for (i = 0; i < ARRAY_SIZE(stack_trace_hash); i++) + if (!hlist_empty(&stack_trace_hash[i])) + c++; + + return c; +} #endif unsigned int nr_hardirq_chains; |