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_NO_REFERENCED_PAGE,	"no_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 	EMe( SCAN_CGROUP_CHARGE_FAIL,	"ccgroup_charge_failed")
32 
33 #undef EM
34 #undef EMe
35 #define EM(a, b)	TRACE_DEFINE_ENUM(a);
36 #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
37 
38 SCAN_STATUS
39 
40 #undef EM
41 #undef EMe
42 #define EM(a, b)	{a, b},
43 #define EMe(a, b)	{a, b}
44 
45 TRACE_EVENT(mm_khugepaged_scan_pmd,
46 
47 	TP_PROTO(struct mm_struct *mm, struct page *page, bool writable,
48 		 bool referenced, int none_or_zero, int status),
49 
50 	TP_ARGS(mm, page, writable, referenced, none_or_zero, status),
51 
52 	TP_STRUCT__entry(
53 		__field(struct mm_struct *, mm)
54 		__field(unsigned long, pfn)
55 		__field(bool, writable)
56 		__field(bool, referenced)
57 		__field(int, none_or_zero)
58 		__field(int, status)
59 	),
60 
61 	TP_fast_assign(
62 		__entry->mm = mm;
63 		__entry->pfn = page ? page_to_pfn(page) : -1;
64 		__entry->writable = writable;
65 		__entry->referenced = referenced;
66 		__entry->none_or_zero = none_or_zero;
67 		__entry->status = status;
68 	),
69 
70 	TP_printk("mm=%p, scan_pfn=0x%lx, writable=%d, referenced=%d, none_or_zero=%d, status=%s",
71 		__entry->mm,
72 		__entry->pfn,
73 		__entry->writable,
74 		__entry->referenced,
75 		__entry->none_or_zero,
76 		__print_symbolic(__entry->status, SCAN_STATUS))
77 );
78 
79 TRACE_EVENT(mm_collapse_huge_page,
80 
81 	TP_PROTO(struct mm_struct *mm, int isolated, int status),
82 
83 	TP_ARGS(mm, isolated, status),
84 
85 	TP_STRUCT__entry(
86 		__field(struct mm_struct *, mm)
87 		__field(int, isolated)
88 		__field(int, status)
89 	),
90 
91 	TP_fast_assign(
92 		__entry->mm = mm;
93 		__entry->isolated = isolated;
94 		__entry->status = status;
95 	),
96 
97 	TP_printk("mm=%p, isolated=%d, status=%s",
98 		__entry->mm,
99 		__entry->isolated,
100 		__print_symbolic(__entry->status, SCAN_STATUS))
101 );
102 
103 TRACE_EVENT(mm_collapse_huge_page_isolate,
104 
105 	TP_PROTO(struct page *page, int none_or_zero,
106 		 bool referenced, bool  writable, int status),
107 
108 	TP_ARGS(page, none_or_zero, referenced, writable, status),
109 
110 	TP_STRUCT__entry(
111 		__field(unsigned long, pfn)
112 		__field(int, none_or_zero)
113 		__field(bool, referenced)
114 		__field(bool, writable)
115 		__field(int, status)
116 	),
117 
118 	TP_fast_assign(
119 		__entry->pfn = page ? page_to_pfn(page) : -1;
120 		__entry->none_or_zero = none_or_zero;
121 		__entry->referenced = referenced;
122 		__entry->writable = writable;
123 		__entry->status = status;
124 	),
125 
126 	TP_printk("scan_pfn=0x%lx, none_or_zero=%d, referenced=%d, writable=%d, status=%s",
127 		__entry->pfn,
128 		__entry->none_or_zero,
129 		__entry->referenced,
130 		__entry->writable,
131 		__print_symbolic(__entry->status, SCAN_STATUS))
132 );
133 
134 #endif /* __HUGE_MEMORY_H */
135 #include <trace/define_trace.h>
136