locking/lockdep: Track number of zapped lock chains
authorWaiman Long <longman@redhat.com>
Thu, 6 Feb 2020 15:24:07 +0000 (10:24 -0500)
committerIngo Molnar <mingo@kernel.org>
Tue, 11 Feb 2020 12:10:51 +0000 (13:10 +0100)
Add a new counter nr_zapped_lock_chains to track the number lock chains
that have been removed.

Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20200206152408.24165-6-longman@redhat.com
kernel/locking/lockdep.c
kernel/locking/lockdep_internals.h
kernel/locking/lockdep_proc.c

index ef2a6432dd10abb49a0ece086447a4be3be3c4a7..a63976c75253c45d0f90ff878884aff3dd7e0f35 100644 (file)
@@ -2626,6 +2626,7 @@ out_bug:
 struct lock_chain lock_chains[MAX_LOCKDEP_CHAINS];
 static DECLARE_BITMAP(lock_chains_in_use, MAX_LOCKDEP_CHAINS);
 static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];
+unsigned long nr_zapped_lock_chains;
 unsigned int nr_chain_hlocks;
 
 struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i)
@@ -4797,6 +4798,7 @@ free_lock_chain:
         */
        hlist_del_rcu(&chain->entry);
        __set_bit(chain - lock_chains, pf->lock_chains_being_freed);
+       nr_zapped_lock_chains++;
 #endif
 }
 
index 926bfa4b4564a7bb7ec15b702e9e9b751403b476..af722ceeda339f545afee69b49204f5db7f802a4 100644 (file)
@@ -131,6 +131,7 @@ struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i);
 
 extern unsigned long nr_lock_classes;
 extern unsigned long nr_zapped_classes;
+extern unsigned long nr_zapped_lock_chains;
 extern unsigned long nr_list_entries;
 long lockdep_next_lockchain(long i);
 unsigned long lock_chain_count(void);
index 53c2a2ab4f0779405526aba805a9185fbd215c76..524580db4779b4cc755cce87ddc62d10f6cd0337 100644 (file)
@@ -349,6 +349,10 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
        seq_puts(m, "\n");
        seq_printf(m, " zapped classes:                %11lu\n",
                        nr_zapped_classes);
+#ifdef CONFIG_PROVE_LOCKING
+       seq_printf(m, " zapped lock chains:            %11lu\n",
+                       nr_zapped_lock_chains);
+#endif
        return 0;
 }