diff options
Diffstat (limited to 'include/linux/lockdep.h')
-rw-r--r-- | include/linux/lockdep.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index b25d1b53df0d..9ccf0e286b2a 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -149,6 +149,12 @@ struct lock_list { | |||
149 | struct lock_class *class; | 149 | struct lock_class *class; |
150 | struct stack_trace trace; | 150 | struct stack_trace trace; |
151 | int distance; | 151 | int distance; |
152 | |||
153 | /* | ||
154 | * The parent field is used to implement breadth-first search, and the | ||
155 | * bit 0 is reused to indicate if the lock has been accessed in BFS. | ||
156 | */ | ||
157 | struct lock_list *parent; | ||
152 | }; | 158 | }; |
153 | 159 | ||
154 | /* | 160 | /* |
@@ -208,10 +214,12 @@ struct held_lock { | |||
208 | * interrupt context: | 214 | * interrupt context: |
209 | */ | 215 | */ |
210 | unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */ | 216 | unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */ |
211 | unsigned int trylock:1; | 217 | unsigned int trylock:1; /* 16 bits */ |
218 | |||
212 | unsigned int read:2; /* see lock_acquire() comment */ | 219 | unsigned int read:2; /* see lock_acquire() comment */ |
213 | unsigned int check:2; /* see lock_acquire() comment */ | 220 | unsigned int check:2; /* see lock_acquire() comment */ |
214 | unsigned int hardirqs_off:1; | 221 | unsigned int hardirqs_off:1; |
222 | unsigned int references:11; /* 32 bits */ | ||
215 | }; | 223 | }; |
216 | 224 | ||
217 | /* | 225 | /* |
@@ -291,6 +299,10 @@ extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
291 | extern void lock_release(struct lockdep_map *lock, int nested, | 299 | extern void lock_release(struct lockdep_map *lock, int nested, |
292 | unsigned long ip); | 300 | unsigned long ip); |
293 | 301 | ||
302 | #define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map) | ||
303 | |||
304 | extern int lock_is_held(struct lockdep_map *lock); | ||
305 | |||
294 | extern void lock_set_class(struct lockdep_map *lock, const char *name, | 306 | extern void lock_set_class(struct lockdep_map *lock, const char *name, |
295 | struct lock_class_key *key, unsigned int subclass, | 307 | struct lock_class_key *key, unsigned int subclass, |
296 | unsigned long ip); | 308 | unsigned long ip); |
@@ -309,6 +321,8 @@ extern void lockdep_trace_alloc(gfp_t mask); | |||
309 | 321 | ||
310 | #define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) | 322 | #define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) |
311 | 323 | ||
324 | #define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l)) | ||
325 | |||
312 | #else /* !LOCKDEP */ | 326 | #else /* !LOCKDEP */ |
313 | 327 | ||
314 | static inline void lockdep_off(void) | 328 | static inline void lockdep_off(void) |
@@ -353,6 +367,8 @@ struct lock_class_key { }; | |||
353 | 367 | ||
354 | #define lockdep_depth(tsk) (0) | 368 | #define lockdep_depth(tsk) (0) |
355 | 369 | ||
370 | #define lockdep_assert_held(l) do { } while (0) | ||
371 | |||
356 | #endif /* !LOCKDEP */ | 372 | #endif /* !LOCKDEP */ |
357 | 373 | ||
358 | #ifdef CONFIG_LOCK_STAT | 374 | #ifdef CONFIG_LOCK_STAT |