Re: [PATCH v2 1/6] locking/lockdep: Track number of zapped classes

From: Waiman Long
Date: Mon Jan 13 2020 - 09:58:41 EST


On 1/13/20 9:55 AM, Peter Zijlstra wrote:
> On Mon, Dec 16, 2019 at 10:15:12AM -0500, Waiman Long wrote:
>> The whole point of the lockdep dynamic key patch is to allow unused
>> locks to be removed from the lockdep data buffers so that existing
>> buffer space can be reused. However, there is no way to find out how
>> many unused locks are zapped and so we don't know if the zapping process
>> is working properly.
>>
>> Add a new nr_zapped_classes variable to track that and show it in
>> /proc/lockdep_stats if it is non-zero.
>>
>> diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
>> index dadb7b7fba37..d98d349bb648 100644
>> --- a/kernel/locking/lockdep_proc.c
>> +++ b/kernel/locking/lockdep_proc.c
>> @@ -336,6 +336,15 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
>> seq_printf(m, " debug_locks: %11u\n",
>> debug_locks);
>>
>> + /*
>> + * Zappped classes and lockdep data buffers reuse statistics.
>> + */
>> + if (!nr_zapped_classes)
>> + return 0;
>> +
>> + seq_puts(m, "\n");
>> + seq_printf(m, " zapped classes: %11lu\n",
>> + nr_zapped_classes);
>> return 0;
>> }
> Why is that conditional?
>
Because I thought zapping class doesn't occur that often. Apparently,
class zapping happens when the system first boots up. I guess that
conditional check isn't needed. I can remove it in the next version.

Cheers,
Longman