diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2008-09-10 03:57:35 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-10 07:48:49 -0400 |
commit | 76b189e91845eab3a9d52bb97f971d312d25652d (patch) | |
tree | 4ce5a577fc58e055febc942987eea8853f54c7a7 /include | |
parent | f648972e017659c741bdd3be6b4aeb2d73672031 (diff) |
lockdep: add might_lock() / might_lock_read()
useful to establish a lock dependency in case the actual dependency is
rare or hard to trigger.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/lockdep.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 331e5f1c2d8..0aa657aa8a1 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -480,4 +480,22 @@ static inline void print_irqtrace_events(struct task_struct *curr) | |||
480 | # define lock_map_release(l) do { } while (0) | 480 | # define lock_map_release(l) do { } while (0) |
481 | #endif | 481 | #endif |
482 | 482 | ||
483 | #ifdef CONFIG_PROVE_LOCKING | ||
484 | # define might_lock(lock) \ | ||
485 | do { \ | ||
486 | typecheck(struct lockdep_map *, &(lock)->dep_map); \ | ||
487 | lock_acquire(&(lock)->dep_map, 0, 0, 0, 2, NULL, _THIS_IP_); \ | ||
488 | lock_release(&(lock)->dep_map, 0, _THIS_IP_); \ | ||
489 | } while (0) | ||
490 | # define might_lock_read(lock) \ | ||
491 | do { \ | ||
492 | typecheck(struct lockdep_map *, &(lock)->dep_map); \ | ||
493 | lock_acquire(&(lock)->dep_map, 0, 0, 1, 2, NULL, _THIS_IP_); \ | ||
494 | lock_release(&(lock)->dep_map, 0, _THIS_IP_); \ | ||
495 | } while (0) | ||
496 | #else | ||
497 | # define might_lock(lock) do { } while (0) | ||
498 | # define might_lock_read(lock) do { } while (0) | ||
499 | #endif | ||
500 | |||
483 | #endif /* __LINUX_LOCKDEP_H */ | 501 | #endif /* __LINUX_LOCKDEP_H */ |