summaryrefslogtreecommitdiff
path: root/include/linux/lockdep.h
diff options
context:
space:
mode:
authorBoqun Feng <boqun.feng@gmail.com>2020-08-07 15:42:25 +0800
committerPeter Zijlstra <peterz@infradead.org>2020-08-26 12:42:04 +0200
commit3454a36d6a39186de508dd43df590a6363364176 (patch)
treee2cce77c493fabdf9b791e6ce02fe8ad8e8ff96a /include/linux/lockdep.h
parentbd76eca10de2eb9998d5125b08e8997cbf5508d5 (diff)
lockdep: Introduce lock_list::dep
To add recursive read locks into the dependency graph, we need to store the types of dependencies for the BFS later. There are four types of dependencies: * Exclusive -> Non-recursive dependencies: EN e.g. write_lock(prev) held and try to acquire write_lock(next) or non-recursive read_lock(next), which can be represented as "prev -(EN)-> next" * Shared -> Non-recursive dependencies: SN e.g. read_lock(prev) held and try to acquire write_lock(next) or non-recursive read_lock(next), which can be represented as "prev -(SN)-> next" * Exclusive -> Recursive dependencies: ER e.g. write_lock(prev) held and try to acquire recursive read_lock(next), which can be represented as "prev -(ER)-> next" * Shared -> Recursive dependencies: SR e.g. read_lock(prev) held and try to acquire recursive read_lock(next), which can be represented as "prev -(SR)-> next" So we use 4 bits for the presence of each type in lock_list::dep. Helper functions and macros are also introduced to convert a pair of locks into lock_list::dep bit and maintain the addition of different types of dependencies. Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20200807074238.1632519-7-boqun.feng@gmail.com
Diffstat (limited to 'include/linux/lockdep.h')
-rw-r--r--include/linux/lockdep.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 22750102b5fe..35c8bb0108dd 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -55,6 +55,8 @@ struct lock_list {
struct lock_class *links_to;
const struct lock_trace *trace;
u16 distance;
+ /* bitmap of different dependencies from head to this */
+ u8 dep;
/*
* The parent field is used to implement breadth-first search, and the