hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/include/linux/rtmutex.h
....@@ -14,10 +14,14 @@
1414 #define __LINUX_RT_MUTEX_H
1515
1616 #include <linux/linkage.h>
17
-#include <linux/rbtree.h>
18
-#include <linux/spinlock_types.h>
17
+#include <linux/rbtree_type.h>
18
+#include <linux/spinlock_types_raw.h>
1919
2020 extern int max_lock_depth; /* for sysctl */
21
+
22
+#ifdef CONFIG_DEBUG_MUTEXES
23
+#include <linux/debug_locks.h>
24
+#endif
2125
2226 /**
2327 * The rt_mutex structure
....@@ -31,12 +35,7 @@
3135 raw_spinlock_t wait_lock;
3236 struct rb_root_cached waiters;
3337 struct task_struct *owner;
34
-#ifdef CONFIG_DEBUG_RT_MUTEXES
3538 int save_state;
36
- const char *name, *file;
37
- int line;
38
- void *magic;
39
-#endif
4039 #ifdef CONFIG_DEBUG_LOCK_ALLOC
4140 struct lockdep_map dep_map;
4241 #endif
....@@ -49,6 +48,7 @@
4948 extern int rt_mutex_debug_check_no_locks_freed(const void *from,
5049 unsigned long len);
5150 extern void rt_mutex_debug_check_no_locks_held(struct task_struct *task);
51
+ extern void rt_mutex_debug_task_free(struct task_struct *tsk);
5252 #else
5353 static inline int rt_mutex_debug_check_no_locks_freed(const void *from,
5454 unsigned long len)
....@@ -56,24 +56,14 @@
5656 return 0;
5757 }
5858 # define rt_mutex_debug_check_no_locks_held(task) do { } while (0)
59
+# define rt_mutex_debug_task_free(t) do { } while (0)
5960 #endif
6061
61
-#ifdef CONFIG_DEBUG_RT_MUTEXES
62
-# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
63
- , .name = #mutexname, .file = __FILE__, .line = __LINE__
64
-
65
-# define rt_mutex_init(mutex) \
62
+#define rt_mutex_init(mutex) \
6663 do { \
6764 static struct lock_class_key __key; \
6865 __rt_mutex_init(mutex, __func__, &__key); \
6966 } while (0)
70
-
71
- extern void rt_mutex_debug_task_free(struct task_struct *tsk);
72
-#else
73
-# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname)
74
-# define rt_mutex_init(mutex) __rt_mutex_init(mutex, NULL, NULL)
75
-# define rt_mutex_debug_task_free(t) do { } while (0)
76
-#endif
7767
7868 #ifdef CONFIG_DEBUG_LOCK_ALLOC
7969 #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) \
....@@ -82,12 +72,19 @@
8272 #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)
8373 #endif
8474
85
-#define __RT_MUTEX_INITIALIZER(mutexname) \
86
- { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
75
+#define __RT_MUTEX_INITIALIZER_PLAIN(mutexname) \
76
+ .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
8777 , .waiters = RB_ROOT_CACHED \
8878 , .owner = NULL \
89
- __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
90
- __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)}
79
+ __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)
80
+
81
+#define __RT_MUTEX_INITIALIZER(mutexname) \
82
+ { __RT_MUTEX_INITIALIZER_PLAIN(mutexname) \
83
+ , .save_state = 0 }
84
+
85
+#define __RT_MUTEX_INITIALIZER_SAVE_STATE(mutexname) \
86
+ { __RT_MUTEX_INITIALIZER_PLAIN(mutexname) \
87
+ , .save_state = 1 }
9188
9289 #define DEFINE_RT_MUTEX(mutexname) \
9390 struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
....@@ -115,9 +112,6 @@
115112 #endif
116113
117114 extern int rt_mutex_lock_interruptible(struct rt_mutex *lock);
118
-extern int rt_mutex_timed_lock(struct rt_mutex *lock,
119
- struct hrtimer_sleeper *timeout);
120
-
121115 extern int rt_mutex_trylock(struct rt_mutex *lock);
122116
123117 extern void rt_mutex_unlock(struct rt_mutex *lock);