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

TOMOYO Linux Cross Reference
Linux/Documentation/locking/rt-mutex.rst

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 /Documentation/locking/rt-mutex.rst (Version linux-6.12-rc7) and /Documentation/locking/rt-mutex.rst (Version linux-4.9.337)


  1 ==================================                
  2 RT-mutex subsystem with PI support                
  3 ==================================                
  4                                                   
  5 RT-mutexes with priority inheritance are used     
  6 which enable pthread_mutex_t priority inherita    
  7 (PTHREAD_PRIO_INHERIT). [See Documentation/loc    
  8 about PI-futexes.]                                
  9                                                   
 10 This technology was developed in the -rt tree     
 11 pthread_mutex support.                            
 12                                                   
 13 Basic principles:                                 
 14 -----------------                                 
 15                                                   
 16 RT-mutexes extend the semantics of simple mute    
 17 inheritance protocol.                             
 18                                                   
 19 A low priority owner of a rt-mutex inherits th    
 20 priority waiter until the rt-mutex is released    
 21 boosted owner blocks on a rt-mutex itself it p    
 22 boosting to the owner of the other rt_mutex it    
 23 priority boosting is immediately removed once     
 24 unlocked.                                         
 25                                                   
 26 This approach allows us to shorten the block o    
 27 mutexes which protect shared resources. Priori    
 28 magic bullet for poorly designed applications,    
 29 well-designed applications to use userspace lo    
 30 an high priority thread, without losing determ    
 31                                                   
 32 The enqueueing of the waiters into the rtmutex    
 33 priority order. For same priorities FIFO order    
 34 rtmutex, only the top priority waiter is enque    
 35 priority waiters tree. This tree too queues in    
 36 the top priority waiter of a task changes (for    
 37 got a signal), the priority of the owner task     
 38 priority enqueueing is handled by "pi_waiters"    
 39                                                   
 40 RT-mutexes are optimized for fastpath operatio    
 41 locking overhead when locking an uncontended m    
 42 without waiters. The optimized fastpath operat    
 43 support. [If that is not available then the rt    
 44 is used]                                          
 45                                                   
 46 The state of the rt-mutex is tracked via the o    
 47 structure:                                        
 48                                                   
 49 lock->owner holds the task_struct pointer of t    
 50 keep track of the "lock has waiters" state:       
 51                                                   
 52  ============ ======= ========================    
 53  owner        bit0    Notes                       
 54  ============ ======= ========================    
 55  NULL         0       lock is free (fast acqui    
 56  NULL         1       lock is free and has wai    
 57                       is going to take the loc    
 58  taskpointer  0       lock is held (fast relea    
 59  taskpointer  1       lock is held and has wai    
 60  ============ ======= ========================    
 61                                                   
 62 The fast atomic compare exchange based acquire    
 63 possible when bit 0 of lock->owner is 0.          
 64                                                   
 65 .. [1] It also can be a transitional state whe    
 66        with ->wait_lock is held. To prevent an    
 67        we need to set the bit0 before looking     
 68        be NULL in this small time, hence this     
 69                                                   
 70 .. [2] There is a small time when bit 0 is set    
 71        waiters. This can happen when grabbing     
 72        To prevent a cmpxchg of the owner relea    
 73        set this bit before looking at the lock    
 74                                                   
 75 BTW, there is still technically a "Pending Own    
 76 that anymore. The pending owner happens to be     
 77 that has no owner and has been woken up to gra    
                                                      

~ [ 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