xref: /linux/include/trace/events/huge_memory.h (revision e5c86679d5e864947a52fb31e45a425dea3e7fa9)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM huge_memory
3 
4 #if !defined(__HUGE_MEMORY_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define __HUGE_MEMORY_H
6 
7 #include  <linux/tracepoint.h>
8 
9 #define SCAN_STATUS							\
10 	EM( SCAN_FAIL,			"failed")			\
11 	EM( SCAN_SUCCEED,		"succeeded")			\
12 	EM( SCAN_PMD_NULL,		"pmd_null")			\
13 	EM( SCAN_EXCEED_NONE_PTE,	"exceed_none_pte")		\
14 	EM( SCAN_PTE_NON_PRESENT,	"pte_non_present")		\
15 	EM( SCAN_PAGE_RO,		"no_writable_page")		\
16 	EM( SCAN_LACK_REFERENCED_PAGE,	"lack_referenced_page")		\
17 	EM( SCAN_PAGE_NULL,		"page_null")			\
18 	EM( SCAN_SCAN_ABORT,		"scan_aborted")			\
19 	EM( SCAN_PAGE_COUNT,		"not_suitable_page_count")	\
20 	EM( SCAN_PAGE_LRU,		"page_not_in_lru")		\
21 	EM( SCAN_PAGE_LOCK,		"page_locked")			\
22 	EM( SCAN_PAGE_ANON,		"page_not_anon")		\
23 	EM( SCAN_PAGE_COMPOUND,		"page_compound")		\
24 	EM( SCAN_ANY_PROCESS,		"no_process_for_page")		\
25 	EM( SCAN_VMA_NULL,		"vma_null")			\
26 	EM( SCAN_VMA_CHECK,		"vma_check_failed")		\
27 	EM( SCAN_ADDRESS_RANGE,		"not_suitable_address_range")	\
28 	EM( SCAN_SWAP_CACHE_PAGE,	"page_swap_cache")		\
29 	EM( SCAN_DEL_PAGE_LRU,		"could_not_delete_page_from_lru")\
30 	EM( SCAN_ALLOC_HUGE_PAGE_FAIL,	"alloc_huge_page_failed")	\
31 	EM( SCAN_CGROUP_CHARGE_FAIL,	"ccgroup_charge_failed")	\
32 	EM( SCAN_EXCEED_SWAP_PTE,	"exceed_swap_pte")		\
33 	EMe(SCAN_TRUNCATED,		"truncated")			\
34 
35 #undef EM
36 #undef EMe
37 #define EM(a, b)	TRACE_DEFINE_ENUM(a);
38 #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
39 
40 SCAN_STATUS
41 
42 #undef EM
43 #undef EMe
44 #define EM(a, b)	{a, b},
45 #define EMe(a, b)	{a, b}
46 
47 TRACE_EVENT(mm_khugepaged_scan_pmd,
48 
49 	TP_PROTO(struct mm_struct *mm, struct page *page, bool writable,
50 		 int referenced, int none_or_zero, int status, int unmapped),
51 
52 	TP_ARGS(mm, page, writable, referenced, none_or_zero, status, unmapped),
53 
54 	TP_STRUCT__entry(
55 		__field(struct mm_struct *, mm)
56 		__field(unsigned long, pfn)
57 		__field(bool, writable)
58 		__field(int, referenced)
59 		__field(int, none_or_zero)
60 		__field(int, status)
61 		__field(int, unmapped)
62 	),
63 
64 	TP_fast_assign(
65 		__entry->mm = mm;
66 		__entry->pfn = page ? page_to_pfn(page) : -1;
67 		__entry->writable = writable;
68 		__entry->referenced = referenced;
69 		__entry->none_or_zero = none_or_zero;
70 		__entry->status = status;
71 		__entry->unmapped = unmapped;
72 	),
73 
74 	TP_printk("mm=%p, scan_pfn=0x%lx, writable=%d, referenced=%d, none_or_zero=%d, status=%s, unmapped=%d",
75 		__entry->mm,
76 		__entry->pfn,
77 		__entry->writable,
78 		__entry->referenced,
79 		__entry->none_or_zero,
80 		__print_symbolic(__entry->status, SCAN_STATUS),
81 		__entry->unmapped)
82 );
83 
84 TRACE_EVENT(mm_collapse_huge_page,
85 
86 	TP_PROTO(struct mm_struct *mm, int isolated, int status),
87 
88 	TP_ARGS(mm, isolated, status),
89 
90 	TP_STRUCT__entry(
91 		__field(struct mm_struct *, mm)
92 		__field(int, isolated)
93 		__field(int, status)
94 	),
95 
96 	TP_fast_assign(
97 		__entry->mm = mm;
98 		__entry->isolated = isolated;
99 		__entry->status = status;
100 	),
101 
102 	TP_printk("mm=%p, isolated=%d, status=%s",
103 		__entry->mm,
104 		__entry->isolated,
105 		__print_symbolic(__entry->status, SCAN_STATUS))
106 );
107 
108 TRACE_EVENT(mm_collapse_huge_page_isolate,
109 
110 	TP_PROTO(struct page *page, int none_or_zero,
111 		 int referenced, bool  writable, int status),
112 
113 	TP_ARGS(page, none_or_zero, referenced, writable, status),
114 
115 	TP_STRUCT__entry(
116 		__field(unsigned long, pfn)
117 		__field(int, none_or_zero)
118 		__field(int, referenced)
119 		__field(bool, writable)
120 		__field(int, status)
121 	),
122 
123 	TP_fast_assign(
124 		__entry->pfn = page ? page_to_pfn(page) : -1;
125 		__entry->none_or_zero = none_or_zero;
126 		__entry->referenced = referenced;
127 		__entry->writable = writable;
128 		__entry->status = status;
129 	),
130 
131 	TP_printk("scan_pfn=0x%lx, none_or_zero=%d, referenced=%d, writable=%d, status=%s",
132 		__entry->pfn,
133 		__entry->none_or_zero,
134 		__entry->referenced,
135 		__entry->writable,
136 		__print_symbolic(__entry->status, SCAN_STATUS))
137 );
138 
139 TRACE_EVENT(mm_collapse_huge_page_swapin,
140 
141 	TP_PROTO(struct mm_struct *mm, int swapped_in, int referenced, int ret),
142 
143 	TP_ARGS(mm, swapped_in, referenced, ret),
144 
145 	TP_STRUCT__entry(
146 		__field(struct mm_struct *, mm)
147 		__field(int, swapped_in)
148 		__field(int, referenced)
149 		__field(int, ret)
150 	),
151 
152 	TP_fast_assign(
153 		__entry->mm = mm;
154 		__entry->swapped_in = swapped_in;
155 		__entry->referenced = referenced;
156 		__entry->ret = ret;
157 	),
158 
159 	TP_printk("mm=%p, swapped_in=%d, referenced=%d, ret=%d",
160 		__entry->mm,
161 		__entry->swapped_in,
162 		__entry->referenced,
163 		__entry->ret)
164 );
165 
166 #endif /* __HUGE_MEMORY_H */
167 #include <trace/define_trace.h>
168