blob: 04f58acda8e851e5f23c4fa340a1d8819ee4abff [file] [log] [blame]
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -08001#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
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -08009#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") \
Ebru Akagunduz0db501f2016-07-26 15:26:46 -070016 EM( SCAN_LACK_REFERENCED_PAGE, "lack_referenced_page") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080017 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") \
Kirill A. Shutemovb1caa952016-01-15 16:52:39 -080023 EM( SCAN_PAGE_COMPOUND, "page_compound") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080024 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") \
Ebru Akagunduz70652f62016-07-26 15:24:59 -070031 EM( SCAN_CGROUP_CHARGE_FAIL, "ccgroup_charge_failed") \
Kirill A. Shutemovf3f0e1d2016-07-26 15:26:32 -070032 EM( SCAN_EXCEED_SWAP_PTE, "exceed_swap_pte") \
33 EMe(SCAN_TRUNCATED, "truncated") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080034
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
40SCAN_STATUS
41
42#undef EM
43#undef EMe
44#define EM(a, b) {a, b},
45#define EMe(a, b) {a, b}
46
47TRACE_EVENT(mm_khugepaged_scan_pmd,
48
yalin wang16fd0fe2016-01-21 16:40:30 -080049 TP_PROTO(struct mm_struct *mm, struct page *page, bool writable,
Ebru Akagunduz0db501f2016-07-26 15:26:46 -070050 int referenced, int none_or_zero, int status, int unmapped),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080051
Ebru Akagunduz70652f62016-07-26 15:24:59 -070052 TP_ARGS(mm, page, writable, referenced, none_or_zero, status, unmapped),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080053
54 TP_STRUCT__entry(
55 __field(struct mm_struct *, mm)
56 __field(unsigned long, pfn)
57 __field(bool, writable)
Ebru Akagunduz0db501f2016-07-26 15:26:46 -070058 __field(int, referenced)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080059 __field(int, none_or_zero)
60 __field(int, status)
Ebru Akagunduz70652f62016-07-26 15:24:59 -070061 __field(int, unmapped)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080062 ),
63
64 TP_fast_assign(
65 __entry->mm = mm;
yalin wang16fd0fe2016-01-21 16:40:30 -080066 __entry->pfn = page ? page_to_pfn(page) : -1;
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080067 __entry->writable = writable;
68 __entry->referenced = referenced;
69 __entry->none_or_zero = none_or_zero;
70 __entry->status = status;
Ebru Akagunduz70652f62016-07-26 15:24:59 -070071 __entry->unmapped = unmapped;
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080072 ),
73
Ebru Akagunduz70652f62016-07-26 15:24:59 -070074 TP_printk("mm=%p, scan_pfn=0x%lx, writable=%d, referenced=%d, none_or_zero=%d, status=%s, unmapped=%d",
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080075 __entry->mm,
76 __entry->pfn,
77 __entry->writable,
78 __entry->referenced,
79 __entry->none_or_zero,
Ebru Akagunduz70652f62016-07-26 15:24:59 -070080 __print_symbolic(__entry->status, SCAN_STATUS),
81 __entry->unmapped)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080082);
83
84TRACE_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
108TRACE_EVENT(mm_collapse_huge_page_isolate,
109
yalin wang16fd0fe2016-01-21 16:40:30 -0800110 TP_PROTO(struct page *page, int none_or_zero,
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700111 int referenced, bool writable, int status),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800112
yalin wang16fd0fe2016-01-21 16:40:30 -0800113 TP_ARGS(page, none_or_zero, referenced, writable, status),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800114
115 TP_STRUCT__entry(
116 __field(unsigned long, pfn)
117 __field(int, none_or_zero)
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700118 __field(int, referenced)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800119 __field(bool, writable)
120 __field(int, status)
121 ),
122
123 TP_fast_assign(
yalin wang16fd0fe2016-01-21 16:40:30 -0800124 __entry->pfn = page ? page_to_pfn(page) : -1;
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800125 __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
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700139TRACE_EVENT(mm_collapse_huge_page_swapin,
140
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700141 TP_PROTO(struct mm_struct *mm, int swapped_in, int referenced, int ret),
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700142
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700143 TP_ARGS(mm, swapped_in, referenced, ret),
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700144
145 TP_STRUCT__entry(
146 __field(struct mm_struct *, mm)
147 __field(int, swapped_in)
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700148 __field(int, referenced)
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700149 __field(int, ret)
150 ),
151
152 TP_fast_assign(
153 __entry->mm = mm;
154 __entry->swapped_in = swapped_in;
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700155 __entry->referenced = referenced;
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700156 __entry->ret = ret;
157 ),
158
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700159 TP_printk("mm=%p, swapped_in=%d, referenced=%d, ret=%d",
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700160 __entry->mm,
161 __entry->swapped_in,
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700162 __entry->referenced,
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700163 __entry->ret)
164);
165
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800166#endif /* __HUGE_MEMORY_H */
167#include <trace/define_trace.h>