[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d66681f3-8781-9793-1dcf-2436a284550b@redhat.com>
Date: Wed, 3 Oct 2018 13:07:18 -0400
From: Waiman Long <longman@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...hat.com>, Will Deacon <will.deacon@....com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/5] locking/lockdep: Make class->ops a percpu counter
On 10/03/2018 09:57 AM, Waiman Long wrote:
> On 10/03/2018 03:48 AM, Peter Zijlstra wrote:
>> On Tue, Oct 02, 2018 at 04:19:19PM -0400, Waiman Long wrote:
>>> +DEFINE_PER_CPU(unsigned long [MAX_LOCKDEP_KEYS], lock_class_ops);
>>> @@ -179,9 +181,30 @@ DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats);
>>> } \
>>> __total; \
>>> })
>>> +
>>> +static inline void debug_class_ops_inc(struct lock_class *class)
>>> +{
>>> + int idx;
>>> +
>>> + idx = class - lock_classes;
>>> + __this_cpu_inc(lock_class_ops[idx]);
>>> +}
>>> +
>>> +static inline unsigned long debug_class_ops_read(struct lock_class *class)
>>> +{
>>> + int idx, cpu;
>>> + unsigned long ops = 0;
>>> +
>>> + idx = class - lock_classes;
>>> + for_each_possible_cpu(cpu)
>>> + ops += per_cpu(lock_class_ops[idx], cpu);
>>> + return ops;
>>> +}
>> Would it make sense to stick that in struct lockdep_stats ?
>>
>> A little something like:
>>
>> struct lockdep_stats {
>> /* ... */
>> int lock_class_ops[MAX_LOCKDEP_KEYS];
>> };
>>
>> and then use:
>>
>> debug_atomic_inc(lock_class_ops[idx]);
>>
> Yes, I can certainly do that. Thanks for pointing this out. Will post an
> updated patch just for this one.
>
> Cheers,
> Longman
>
Attached is the updated patch 4. Please let me know if you guys are OK
with that.
Cheers,
Longman
View attachment "v3-0004-locking-lockdep-Make-class-ops-a-percpu-counter.patch" of type "text/x-patch" (5413 bytes)
Powered by blists - more mailing lists