Skip to content

Commit 797b82e

Browse files
Waiman-LongIngo Molnar
authored andcommitted
locking/lockdep: Track number of zapped lock chains
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
1 parent 836bd74 commit 797b82e

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

kernel/locking/lockdep.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,6 +2626,7 @@ check_prevs_add(struct task_struct *curr, struct held_lock *next)
26262626
struct lock_chain lock_chains[MAX_LOCKDEP_CHAINS];
26272627
static DECLARE_BITMAP(lock_chains_in_use, MAX_LOCKDEP_CHAINS);
26282628
static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];
2629+
unsigned long nr_zapped_lock_chains;
26292630
unsigned int nr_chain_hlocks;
26302631

26312632
struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i)
@@ -4797,6 +4798,7 @@ static void remove_class_from_lock_chain(struct pending_free *pf,
47974798
*/
47984799
hlist_del_rcu(&chain->entry);
47994800
__set_bit(chain - lock_chains, pf->lock_chains_being_freed);
4801+
nr_zapped_lock_chains++;
48004802
#endif
48014803
}
48024804

kernel/locking/lockdep_internals.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i);
131131

132132
extern unsigned long nr_lock_classes;
133133
extern unsigned long nr_zapped_classes;
134+
extern unsigned long nr_zapped_lock_chains;
134135
extern unsigned long nr_list_entries;
135136
long lockdep_next_lockchain(long i);
136137
unsigned long lock_chain_count(void);

kernel/locking/lockdep_proc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,10 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
349349
seq_puts(m, "\n");
350350
seq_printf(m, " zapped classes: %11lu\n",
351351
nr_zapped_classes);
352+
#ifdef CONFIG_PROVE_LOCKING
353+
seq_printf(m, " zapped lock chains: %11lu\n",
354+
nr_zapped_lock_chains);
355+
#endif
352356
return 0;
353357
}
354358

0 commit comments

Comments
 (0)