lkml.org 
[lkml]   [2018]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 4/5] locking/lockdep: Make class->ops a percpu counter
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]);

\
 
 \ /
  Last update: 2018-10-03 09:49    [W:0.054 / U:1.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site