~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/rtmutex.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/rtmutex.h (Version linux-6.12-rc7) and /include/linux/rtmutex.h (Version linux-6.3.13)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*                                                  2 /*
  3  * RT Mutexes: blocking mutual exclusion locks      3  * RT Mutexes: blocking mutual exclusion locks with PI support
  4  *                                                  4  *
  5  * started by Ingo Molnar and Thomas Gleixner:      5  * started by Ingo Molnar and Thomas Gleixner:
  6  *                                                  6  *
  7  *  Copyright (C) 2004-2006 Red Hat, Inc., Ing      7  *  Copyright (C) 2004-2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
  8  *  Copyright (C) 2006, Timesys Corp., Thomas       8  *  Copyright (C) 2006, Timesys Corp., Thomas Gleixner <tglx@timesys.com>
  9  *                                                  9  *
 10  * This file contains the public data structur     10  * This file contains the public data structure and API definitions.
 11  */                                                11  */
 12                                                    12 
 13 #ifndef __LINUX_RT_MUTEX_H                         13 #ifndef __LINUX_RT_MUTEX_H
 14 #define __LINUX_RT_MUTEX_H                         14 #define __LINUX_RT_MUTEX_H
 15                                                    15 
 16 #include <linux/compiler.h>                        16 #include <linux/compiler.h>
 17 #include <linux/linkage.h>                         17 #include <linux/linkage.h>
 18 #include <linux/rbtree_types.h>                    18 #include <linux/rbtree_types.h>
 19 #include <linux/spinlock_types_raw.h>              19 #include <linux/spinlock_types_raw.h>
 20                                                    20 
 21 extern int max_lock_depth; /* for sysctl */        21 extern int max_lock_depth; /* for sysctl */
 22                                                    22 
 23 struct rt_mutex_base {                             23 struct rt_mutex_base {
 24         raw_spinlock_t          wait_lock;         24         raw_spinlock_t          wait_lock;
 25         struct rb_root_cached   waiters;           25         struct rb_root_cached   waiters;
 26         struct task_struct      *owner;            26         struct task_struct      *owner;
 27 };                                                 27 };
 28                                                    28 
 29 #define __RT_MUTEX_BASE_INITIALIZER(rtbasename     29 #define __RT_MUTEX_BASE_INITIALIZER(rtbasename)                         \
 30 {                                                  30 {                                                                       \
 31         .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(     31         .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(rtbasename.wait_lock),    \
 32         .waiters = RB_ROOT_CACHED,                 32         .waiters = RB_ROOT_CACHED,                                      \
 33         .owner = NULL                              33         .owner = NULL                                                   \
 34 }                                                  34 }
 35                                                    35 
 36 /**                                                36 /**
 37  * rt_mutex_base_is_locked - is the rtmutex lo     37  * rt_mutex_base_is_locked - is the rtmutex locked
 38  * @lock: the mutex to be queried                  38  * @lock: the mutex to be queried
 39  *                                                 39  *
 40  * Returns true if the mutex is locked, false      40  * Returns true if the mutex is locked, false if unlocked.
 41  */                                                41  */
 42 static inline bool rt_mutex_base_is_locked(str     42 static inline bool rt_mutex_base_is_locked(struct rt_mutex_base *lock)
 43 {                                                  43 {
 44         return READ_ONCE(lock->owner) != NULL;     44         return READ_ONCE(lock->owner) != NULL;
 45 }                                                  45 }
 46                                                    46 
 47 extern void rt_mutex_base_init(struct rt_mutex     47 extern void rt_mutex_base_init(struct rt_mutex_base *rtb);
 48                                                    48 
 49 /**                                                49 /**
 50  * The rt_mutex structure                          50  * The rt_mutex structure
 51  *                                                 51  *
 52  * @wait_lock:  spinlock to protect the struct     52  * @wait_lock:  spinlock to protect the structure
 53  * @waiters:    rbtree root to enqueue waiters     53  * @waiters:    rbtree root to enqueue waiters in priority order;
 54  *              caches top-waiter (leftmost no     54  *              caches top-waiter (leftmost node).
 55  * @owner:      the mutex owner                    55  * @owner:      the mutex owner
 56  */                                                56  */
 57 struct rt_mutex {                                  57 struct rt_mutex {
 58         struct rt_mutex_base    rtmutex;           58         struct rt_mutex_base    rtmutex;
 59 #ifdef CONFIG_DEBUG_LOCK_ALLOC                     59 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 60         struct lockdep_map      dep_map;           60         struct lockdep_map      dep_map;
 61 #endif                                             61 #endif
 62 };                                                 62 };
 63                                                    63 
 64 struct rt_mutex_waiter;                            64 struct rt_mutex_waiter;
 65 struct hrtimer_sleeper;                            65 struct hrtimer_sleeper;
 66                                                    66 
 67 #ifdef CONFIG_DEBUG_RT_MUTEXES                     67 #ifdef CONFIG_DEBUG_RT_MUTEXES
 68 extern void rt_mutex_debug_task_free(struct ta     68 extern void rt_mutex_debug_task_free(struct task_struct *tsk);
 69 #else                                              69 #else
 70 static inline void rt_mutex_debug_task_free(st     70 static inline void rt_mutex_debug_task_free(struct task_struct *tsk) { }
 71 #endif                                             71 #endif
 72                                                    72 
 73 #define rt_mutex_init(mutex) \                     73 #define rt_mutex_init(mutex) \
 74 do { \                                             74 do { \
 75         static struct lock_class_key __key; \      75         static struct lock_class_key __key; \
 76         __rt_mutex_init(mutex, __func__, &__ke     76         __rt_mutex_init(mutex, __func__, &__key); \
 77 } while (0)                                        77 } while (0)
 78                                                    78 
 79 #ifdef CONFIG_DEBUG_LOCK_ALLOC                     79 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 80 #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexna     80 #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)       \
 81         .dep_map = {                               81         .dep_map = {                                    \
 82                 .name = #mutexname,                82                 .name = #mutexname,                     \
 83                 .wait_type_inner = LD_WAIT_SLE     83                 .wait_type_inner = LD_WAIT_SLEEP,       \
 84         }                                          84         }
 85 #else                                              85 #else
 86 #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexna     86 #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)
 87 #endif                                             87 #endif
 88                                                    88 
 89 #define __RT_MUTEX_INITIALIZER(mutexname)          89 #define __RT_MUTEX_INITIALIZER(mutexname)                               \
 90 {                                                  90 {                                                                       \
 91         .rtmutex = __RT_MUTEX_BASE_INITIALIZER     91         .rtmutex = __RT_MUTEX_BASE_INITIALIZER(mutexname.rtmutex),      \
 92         __DEP_MAP_RT_MUTEX_INITIALIZER(mutexna     92         __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)                       \
 93 }                                                  93 }
 94                                                    94 
 95 #define DEFINE_RT_MUTEX(mutexname) \               95 #define DEFINE_RT_MUTEX(mutexname) \
 96         struct rt_mutex mutexname = __RT_MUTEX     96         struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
 97                                                    97 
 98 extern void __rt_mutex_init(struct rt_mutex *l     98 extern void __rt_mutex_init(struct rt_mutex *lock, const char *name, struct lock_class_key *key);
 99                                                    99 
100 #ifdef CONFIG_DEBUG_LOCK_ALLOC                    100 #ifdef CONFIG_DEBUG_LOCK_ALLOC
101 extern void rt_mutex_lock_nested(struct rt_mut    101 extern void rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int subclass);
102 extern void _rt_mutex_lock_nest_lock(struct rt    102 extern void _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map *nest_lock);
103 #define rt_mutex_lock(lock) rt_mutex_lock_nest    103 #define rt_mutex_lock(lock) rt_mutex_lock_nested(lock, 0)
104 #define rt_mutex_lock_nest_lock(lock, nest_loc    104 #define rt_mutex_lock_nest_lock(lock, nest_lock)                        \
105         do {                                      105         do {                                                            \
106                 typecheck(struct lockdep_map *    106                 typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \
107                 _rt_mutex_lock_nest_lock(lock,    107                 _rt_mutex_lock_nest_lock(lock, &(nest_lock)->dep_map);  \
108         } while (0)                               108         } while (0)
109                                                   109 
110 #else                                             110 #else
111 extern void rt_mutex_lock(struct rt_mutex *loc    111 extern void rt_mutex_lock(struct rt_mutex *lock);
112 #define rt_mutex_lock_nested(lock, subclass) r    112 #define rt_mutex_lock_nested(lock, subclass) rt_mutex_lock(lock)
113 #define rt_mutex_lock_nest_lock(lock, nest_loc    113 #define rt_mutex_lock_nest_lock(lock, nest_lock) rt_mutex_lock(lock)
114 #endif                                            114 #endif
115                                                   115 
116 extern int rt_mutex_lock_interruptible(struct     116 extern int rt_mutex_lock_interruptible(struct rt_mutex *lock);
117 extern int rt_mutex_lock_killable(struct rt_mu    117 extern int rt_mutex_lock_killable(struct rt_mutex *lock);
118 extern int rt_mutex_trylock(struct rt_mutex *l    118 extern int rt_mutex_trylock(struct rt_mutex *lock);
119                                                   119 
120 extern void rt_mutex_unlock(struct rt_mutex *l    120 extern void rt_mutex_unlock(struct rt_mutex *lock);
121                                                   121 
122 #endif                                            122 #endif
123                                                   123 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php