xref: /openbmc/linux/include/trace/events/mmap_lock.h (revision 73c9a3f3)
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 extern int trace_mmap_lock_reg(void);
14 extern void trace_mmap_lock_unreg(void);
15 
16 TRACE_EVENT_FN(mmap_lock_start_locking,
17 
18 	TP_PROTO(struct mm_struct *mm, const char *memcg_path, bool write),
19 
20 	TP_ARGS(mm, memcg_path, write),
21 
22 	TP_STRUCT__entry(
23 		__field(struct mm_struct *, mm)
24 		__string(memcg_path, memcg_path)
25 		__field(bool, write)
26 	),
27 
28 	TP_fast_assign(
29 		__entry->mm = mm;
30 		__assign_str(memcg_path, memcg_path);
31 		__entry->write = write;
32 	),
33 
34 	TP_printk(
35 		"mm=%p memcg_path=%s write=%s\n",
36 		__entry->mm,
37 		__get_str(memcg_path),
38 		__entry->write ? "true" : "false"
39 	),
40 
41 	trace_mmap_lock_reg, trace_mmap_lock_unreg
42 );
43 
44 TRACE_EVENT_FN(mmap_lock_acquire_returned,
45 
46 	TP_PROTO(struct mm_struct *mm, const char *memcg_path, bool write,
47 		bool success),
48 
49 	TP_ARGS(mm, memcg_path, write, success),
50 
51 	TP_STRUCT__entry(
52 		__field(struct mm_struct *, mm)
53 		__string(memcg_path, memcg_path)
54 		__field(bool, write)
55 		__field(bool, success)
56 	),
57 
58 	TP_fast_assign(
59 		__entry->mm = mm;
60 		__assign_str(memcg_path, memcg_path);
61 		__entry->write = write;
62 		__entry->success = success;
63 	),
64 
65 	TP_printk(
66 		"mm=%p memcg_path=%s write=%s success=%s\n",
67 		__entry->mm,
68 		__get_str(memcg_path),
69 		__entry->write ? "true" : "false",
70 		__entry->success ? "true" : "false"
71 	),
72 
73 	trace_mmap_lock_reg, trace_mmap_lock_unreg
74 );
75 
76 TRACE_EVENT_FN(mmap_lock_released,
77 
78 	TP_PROTO(struct mm_struct *mm, const char *memcg_path, bool write),
79 
80 	TP_ARGS(mm, memcg_path, write),
81 
82 	TP_STRUCT__entry(
83 		__field(struct mm_struct *, mm)
84 		__string(memcg_path, memcg_path)
85 		__field(bool, write)
86 	),
87 
88 	TP_fast_assign(
89 		__entry->mm = mm;
90 		__assign_str(memcg_path, memcg_path);
91 		__entry->write = write;
92 	),
93 
94 	TP_printk(
95 		"mm=%p memcg_path=%s write=%s\n",
96 		__entry->mm,
97 		__get_str(memcg_path),
98 		__entry->write ? "true" : "false"
99 	),
100 
101 	trace_mmap_lock_reg, trace_mmap_lock_unreg
102 );
103 
104 #endif /* _TRACE_MMAP_LOCK_H */
105 
106 /* This part must be outside protection */
107 #include <trace/define_trace.h>
108