diff options
Diffstat (limited to 'kernel/locking/lockdep_internals.h')
-rw-r--r-- | kernel/locking/lockdep_internals.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h index d459d624ba2a..88c847a41c8a 100644 --- a/kernel/locking/lockdep_internals.h +++ b/kernel/locking/lockdep_internals.h | |||
@@ -152,9 +152,15 @@ struct lockdep_stats { | |||
152 | int nr_find_usage_forwards_recursions; | 152 | int nr_find_usage_forwards_recursions; |
153 | int nr_find_usage_backwards_checks; | 153 | int nr_find_usage_backwards_checks; |
154 | int nr_find_usage_backwards_recursions; | 154 | int nr_find_usage_backwards_recursions; |
155 | |||
156 | /* | ||
157 | * Per lock class locking operation stat counts | ||
158 | */ | ||
159 | unsigned long lock_class_ops[MAX_LOCKDEP_KEYS]; | ||
155 | }; | 160 | }; |
156 | 161 | ||
157 | DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats); | 162 | DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats); |
163 | extern struct lock_class lock_classes[MAX_LOCKDEP_KEYS]; | ||
158 | 164 | ||
159 | #define __debug_atomic_inc(ptr) \ | 165 | #define __debug_atomic_inc(ptr) \ |
160 | this_cpu_inc(lockdep_stats.ptr); | 166 | this_cpu_inc(lockdep_stats.ptr); |
@@ -179,9 +185,30 @@ DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats); | |||
179 | } \ | 185 | } \ |
180 | __total; \ | 186 | __total; \ |
181 | }) | 187 | }) |
188 | |||
189 | static inline void debug_class_ops_inc(struct lock_class *class) | ||
190 | { | ||
191 | int idx; | ||
192 | |||
193 | idx = class - lock_classes; | ||
194 | __debug_atomic_inc(lock_class_ops[idx]); | ||
195 | } | ||
196 | |||
197 | static inline unsigned long debug_class_ops_read(struct lock_class *class) | ||
198 | { | ||
199 | int idx, cpu; | ||
200 | unsigned long ops = 0; | ||
201 | |||
202 | idx = class - lock_classes; | ||
203 | for_each_possible_cpu(cpu) | ||
204 | ops += per_cpu(lockdep_stats.lock_class_ops[idx], cpu); | ||
205 | return ops; | ||
206 | } | ||
207 | |||
182 | #else | 208 | #else |
183 | # define __debug_atomic_inc(ptr) do { } while (0) | 209 | # define __debug_atomic_inc(ptr) do { } while (0) |
184 | # define debug_atomic_inc(ptr) do { } while (0) | 210 | # define debug_atomic_inc(ptr) do { } while (0) |
185 | # define debug_atomic_dec(ptr) do { } while (0) | 211 | # define debug_atomic_dec(ptr) do { } while (0) |
186 | # define debug_atomic_read(ptr) 0 | 212 | # define debug_atomic_read(ptr) 0 |
213 | # define debug_class_ops_inc(ptr) do { } while (0) | ||
187 | #endif | 214 | #endif |