1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM mmap_lock 4 5 #if !defined(_TRACE_MMAP_LOCK_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_MMAP_LOCK_H 7 8 #include <linux/tracepoint.h> 9 #include <linux/types.h> 10 11 struct mm_struct; 12 13 DECLARE_EVENT_CLASS(mmap_lock, 14 15 TP_PROTO(struct mm_struct *mm, const char *memcg_path, bool write), 16 17 TP_ARGS(mm, memcg_path, write), 18 19 TP_STRUCT__entry( 20 __field(struct mm_struct *, mm) 21 __string(memcg_path, memcg_path) 22 __field(bool, write) 23 ), 24 25 TP_fast_assign( 26 __entry->mm = mm; 27 __assign_str(memcg_path); 28 __entry->write = write; 29 ), 30 31 TP_printk( 32 "mm=%p memcg_path=%s write=%s", 33 __entry->mm, 34 __get_str(memcg_path), 35 __entry->write ? "true" : "false" 36 ) 37 ); 38 39 #define DEFINE_MMAP_LOCK_EVENT(name) \ 40 DEFINE_EVENT(mmap_lock, name, \ 41 TP_PROTO(struct mm_struct *mm, const char *memcg_path, \ 42 bool write), \ 43 TP_ARGS(mm, memcg_path, write)) 44 45 DEFINE_MMAP_LOCK_EVENT(mmap_lock_start_locking); 46 DEFINE_MMAP_LOCK_EVENT(mmap_lock_released); 47 48 TRACE_EVENT(mmap_lock_acquire_returned, 49 50 TP_PROTO(struct mm_struct *mm, const char *memcg_path, bool write, 51 bool success), 52 53 TP_ARGS(mm, memcg_path, write, success), 54 55 TP_STRUCT__entry( 56 __field(struct mm_struct *, mm) 57 __string(memcg_path, memcg_path) 58 __field(bool, write) 59 __field(bool, success) 60 ), 61 62 TP_fast_assign( 63 __entry->mm = mm; 64 __assign_str(memcg_path); 65 __entry->write = write; 66 __entry->success = success; 67 ), 68 69 TP_printk( 70 "mm=%p memcg_path=%s write=%s success=%s", 71 __entry->mm, 72 __get_str(memcg_path), 73 __entry->write ? "true" : "false", 74 __entry->success ? "true" : "false" 75 ) 76 ); 77 78 #endif /* _TRACE_MMAP_LOCK_H */ 79 80 /* This part must be outside protection */ 81 #include <trace/define_trace.h> 82