blob: 47c6212d8f3cecb07d62cb9ea81f6ea65ae0c35f [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
9#include <trace/events/gfpflags.h>
10
11#define SCAN_STATUS \
12 EM( SCAN_FAIL, "failed") \
13 EM( SCAN_SUCCEED, "succeeded") \
14 EM( SCAN_PMD_NULL, "pmd_null") \
15 EM( SCAN_EXCEED_NONE_PTE, "exceed_none_pte") \
16 EM( SCAN_PTE_NON_PRESENT, "pte_non_present") \
17 EM( SCAN_PAGE_RO, "no_writable_page") \
18 EM( SCAN_NO_REFERENCED_PAGE, "no_referenced_page") \
19 EM( SCAN_PAGE_NULL, "page_null") \
20 EM( SCAN_SCAN_ABORT, "scan_aborted") \
21 EM( SCAN_PAGE_COUNT, "not_suitable_page_count") \
22 EM( SCAN_PAGE_LRU, "page_not_in_lru") \
23 EM( SCAN_PAGE_LOCK, "page_locked") \
24 EM( SCAN_PAGE_ANON, "page_not_anon") \
Kirill A. Shutemovb1caa952016-01-15 16:52:39 -080025 EM( SCAN_PAGE_COMPOUND, "page_compound") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080026 EM( SCAN_ANY_PROCESS, "no_process_for_page") \
27 EM( SCAN_VMA_NULL, "vma_null") \
28 EM( SCAN_VMA_CHECK, "vma_check_failed") \
29 EM( SCAN_ADDRESS_RANGE, "not_suitable_address_range") \
30 EM( SCAN_SWAP_CACHE_PAGE, "page_swap_cache") \
31 EM( SCAN_DEL_PAGE_LRU, "could_not_delete_page_from_lru")\
32 EM( SCAN_ALLOC_HUGE_PAGE_FAIL, "alloc_huge_page_failed") \
33 EMe( SCAN_CGROUP_CHARGE_FAIL, "ccgroup_charge_failed")
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
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 Akagunduz7d2eba02016-01-14 15:22:19 -080050 bool referenced, int none_or_zero, int status),
51
yalin wang16fd0fe2016-01-21 16:40:30 -080052 TP_ARGS(mm, page, writable, referenced, none_or_zero, status),
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)
58 __field(bool, referenced)
59 __field(int, none_or_zero)
60 __field(int, status)
61 ),
62
63 TP_fast_assign(
64 __entry->mm = mm;
yalin wang16fd0fe2016-01-21 16:40:30 -080065 __entry->pfn = page ? page_to_pfn(page) : -1;
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080066 __entry->writable = writable;
67 __entry->referenced = referenced;
68 __entry->none_or_zero = none_or_zero;
69 __entry->status = status;
70 ),
71
72 TP_printk("mm=%p, scan_pfn=0x%lx, writable=%d, referenced=%d, none_or_zero=%d, status=%s",
73 __entry->mm,
74 __entry->pfn,
75 __entry->writable,
76 __entry->referenced,
77 __entry->none_or_zero,
78 __print_symbolic(__entry->status, SCAN_STATUS))
79);
80
81TRACE_EVENT(mm_collapse_huge_page,
82
83 TP_PROTO(struct mm_struct *mm, int isolated, int status),
84
85 TP_ARGS(mm, isolated, status),
86
87 TP_STRUCT__entry(
88 __field(struct mm_struct *, mm)
89 __field(int, isolated)
90 __field(int, status)
91 ),
92
93 TP_fast_assign(
94 __entry->mm = mm;
95 __entry->isolated = isolated;
96 __entry->status = status;
97 ),
98
99 TP_printk("mm=%p, isolated=%d, status=%s",
100 __entry->mm,
101 __entry->isolated,
102 __print_symbolic(__entry->status, SCAN_STATUS))
103);
104
105TRACE_EVENT(mm_collapse_huge_page_isolate,
106
yalin wang16fd0fe2016-01-21 16:40:30 -0800107 TP_PROTO(struct page *page, int none_or_zero,
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800108 bool referenced, bool writable, int status),
109
yalin wang16fd0fe2016-01-21 16:40:30 -0800110 TP_ARGS(page, none_or_zero, referenced, writable, status),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800111
112 TP_STRUCT__entry(
113 __field(unsigned long, pfn)
114 __field(int, none_or_zero)
115 __field(bool, referenced)
116 __field(bool, writable)
117 __field(int, status)
118 ),
119
120 TP_fast_assign(
yalin wang16fd0fe2016-01-21 16:40:30 -0800121 __entry->pfn = page ? page_to_pfn(page) : -1;
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800122 __entry->none_or_zero = none_or_zero;
123 __entry->referenced = referenced;
124 __entry->writable = writable;
125 __entry->status = status;
126 ),
127
128 TP_printk("scan_pfn=0x%lx, none_or_zero=%d, referenced=%d, writable=%d, status=%s",
129 __entry->pfn,
130 __entry->none_or_zero,
131 __entry->referenced,
132 __entry->writable,
133 __print_symbolic(__entry->status, SCAN_STATUS))
134);
135
136#endif /* __HUGE_MEMORY_H */
137#include <trace/define_trace.h>