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

TOMOYO Linux Cross Reference
Linux/mm/mmap_lock.c

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 /mm/mmap_lock.c (Version linux-6.12-rc7) and /mm/mmap_lock.c (Version linux-4.19.322)


** Warning: Cannot open xref database.

  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 #define CREATE_TRACE_POINTS                       
  3 #include <trace/events/mmap_lock.h>               
  4                                                   
  5 #include <linux/mm.h>                             
  6 #include <linux/cgroup.h>                         
  7 #include <linux/memcontrol.h>                     
  8 #include <linux/mmap_lock.h>                      
  9 #include <linux/mutex.h>                          
 10 #include <linux/percpu.h>                         
 11 #include <linux/rcupdate.h>                       
 12 #include <linux/smp.h>                            
 13 #include <linux/trace_events.h>                   
 14 #include <linux/local_lock.h>                     
 15                                                   
 16 EXPORT_TRACEPOINT_SYMBOL(mmap_lock_start_locki    
 17 EXPORT_TRACEPOINT_SYMBOL(mmap_lock_acquire_ret    
 18 EXPORT_TRACEPOINT_SYMBOL(mmap_lock_released);     
 19                                                   
 20 #ifdef CONFIG_MEMCG                               
 21                                                   
 22 static atomic_t reg_refcount;                     
 23                                                   
 24 /*                                                
 25  * Size of the buffer for memcg path names. Ig    
 26  * trace_events_hist.c uses MAX_FILTER_STR_VAL    
 27  */                                               
 28 #define MEMCG_PATH_BUF_SIZE MAX_FILTER_STR_VAL    
 29                                                   
 30 int trace_mmap_lock_reg(void)                     
 31 {                                                 
 32         atomic_inc(&reg_refcount);                
 33         return 0;                                 
 34 }                                                 
 35                                                   
 36 void trace_mmap_lock_unreg(void)                  
 37 {                                                 
 38         atomic_dec(&reg_refcount);                
 39 }                                                 
 40                                                   
 41 #define TRACE_MMAP_LOCK_EVENT(type, mm, ...)      
 42         do {                                      
 43                 char buf[MEMCG_PATH_BUF_SIZE];    
 44                 get_mm_memcg_path(mm, buf, siz    
 45                 trace_mmap_lock_##type(mm, buf    
 46         } while (0)                               
 47                                                   
 48 #else /* !CONFIG_MEMCG */                         
 49                                                   
 50 int trace_mmap_lock_reg(void)                     
 51 {                                                 
 52         return 0;                                 
 53 }                                                 
 54                                                   
 55 void trace_mmap_lock_unreg(void)                  
 56 {                                                 
 57 }                                                 
 58                                                   
 59 #define TRACE_MMAP_LOCK_EVENT(type, mm, ...)      
 60         trace_mmap_lock_##type(mm, "", ##__VA_    
 61                                                   
 62 #endif /* CONFIG_MEMCG */                         
 63                                                   
 64 #ifdef CONFIG_TRACING                             
 65 #ifdef CONFIG_MEMCG                               
 66 /*                                                
 67  * Write the given mm_struct's memcg path to a    
 68  * determined or the trace event is being unre    
 69  */                                               
 70 static void get_mm_memcg_path(struct mm_struct    
 71 {                                                 
 72         struct mem_cgroup *memcg;                 
 73                                                   
 74         buf[0] = '\0';                            
 75         /* No need to get path if no trace eve    
 76         if (!atomic_read(&reg_refcount))          
 77                 return;                           
 78         memcg = get_mem_cgroup_from_mm(mm);       
 79         if (memcg == NULL)                        
 80                 return;                           
 81         if (memcg->css.cgroup)                    
 82                 cgroup_path(memcg->css.cgroup,    
 83         css_put(&memcg->css);                     
 84 }                                                 
 85                                                   
 86 #endif /* CONFIG_MEMCG */                         
 87                                                   
 88 /*                                                
 89  * Trace calls must be in a separate file, as     
 90  * dependency between linux/mmap_lock.h and tr    
 91  */                                               
 92                                                   
 93 void __mmap_lock_do_trace_start_locking(struct    
 94 {                                                 
 95         TRACE_MMAP_LOCK_EVENT(start_locking, m    
 96 }                                                 
 97 EXPORT_SYMBOL(__mmap_lock_do_trace_start_locki    
 98                                                   
 99 void __mmap_lock_do_trace_acquire_returned(str    
100                                            boo    
101 {                                                 
102         TRACE_MMAP_LOCK_EVENT(acquire_returned    
103 }                                                 
104 EXPORT_SYMBOL(__mmap_lock_do_trace_acquire_ret    
105                                                   
106 void __mmap_lock_do_trace_released(struct mm_s    
107 {                                                 
108         TRACE_MMAP_LOCK_EVENT(released, mm, wr    
109 }                                                 
110 EXPORT_SYMBOL(__mmap_lock_do_trace_released);     
111 #endif /* CONFIG_TRACING */                       
112                                                   

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