blob: 70e32ff096ec0c2b84a24a4b7df00def3aba8b98 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -08002#undef TRACE_SYSTEM
3#define TRACE_SYSTEM huge_memory
4
5#if !defined(__HUGE_MEMORY_H) || defined(TRACE_HEADER_MULTI_READ)
6#define __HUGE_MEMORY_H
7
8#include <linux/tracepoint.h>
9
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080010#define SCAN_STATUS \
11 EM( SCAN_FAIL, "failed") \
12 EM( SCAN_SUCCEED, "succeeded") \
13 EM( SCAN_PMD_NULL, "pmd_null") \
14 EM( SCAN_EXCEED_NONE_PTE, "exceed_none_pte") \
15 EM( SCAN_PTE_NON_PRESENT, "pte_non_present") \
Peter Xue1e267c2020-04-06 20:06:04 -070016 EM( SCAN_PTE_UFFD_WP, "pte_uffd_wp") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080017 EM( SCAN_PAGE_RO, "no_writable_page") \
Ebru Akagunduz0db501f2016-07-26 15:26:46 -070018 EM( SCAN_LACK_REFERENCED_PAGE, "lack_referenced_page") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080019 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") \
Ebru Akagunduz70652f62016-07-26 15:24:59 -070033 EM( SCAN_CGROUP_CHARGE_FAIL, "ccgroup_charge_failed") \
Kirill A. Shutemovf3f0e1d2016-07-26 15:26:32 -070034 EM( SCAN_EXCEED_SWAP_PTE, "exceed_swap_pte") \
Yang Shi554913f2020-01-13 16:29:36 -080035 EM( SCAN_TRUNCATED, "truncated") \
36 EMe(SCAN_PAGE_HAS_PRIVATE, "page_has_private") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080037
38#undef EM
39#undef EMe
40#define EM(a, b) TRACE_DEFINE_ENUM(a);
41#define EMe(a, b) TRACE_DEFINE_ENUM(a);
42
43SCAN_STATUS
44
45#undef EM
46#undef EMe
47#define EM(a, b) {a, b},
48#define EMe(a, b) {a, b}
49
50TRACE_EVENT(mm_khugepaged_scan_pmd,
51
yalin wang16fd0fe2016-01-21 16:40:30 -080052 TP_PROTO(struct mm_struct *mm, struct page *page, bool writable,
Ebru Akagunduz0db501f2016-07-26 15:26:46 -070053 int referenced, int none_or_zero, int status, int unmapped),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080054
Ebru Akagunduz70652f62016-07-26 15:24:59 -070055 TP_ARGS(mm, page, writable, referenced, none_or_zero, status, unmapped),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080056
57 TP_STRUCT__entry(
58 __field(struct mm_struct *, mm)
59 __field(unsigned long, pfn)
60 __field(bool, writable)
Ebru Akagunduz0db501f2016-07-26 15:26:46 -070061 __field(int, referenced)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080062 __field(int, none_or_zero)
63 __field(int, status)
Ebru Akagunduz70652f62016-07-26 15:24:59 -070064 __field(int, unmapped)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080065 ),
66
67 TP_fast_assign(
68 __entry->mm = mm;
yalin wang16fd0fe2016-01-21 16:40:30 -080069 __entry->pfn = page ? page_to_pfn(page) : -1;
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080070 __entry->writable = writable;
71 __entry->referenced = referenced;
72 __entry->none_or_zero = none_or_zero;
73 __entry->status = status;
Ebru Akagunduz70652f62016-07-26 15:24:59 -070074 __entry->unmapped = unmapped;
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080075 ),
76
Ebru Akagunduz70652f62016-07-26 15:24:59 -070077 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 -080078 __entry->mm,
79 __entry->pfn,
80 __entry->writable,
81 __entry->referenced,
82 __entry->none_or_zero,
Ebru Akagunduz70652f62016-07-26 15:24:59 -070083 __print_symbolic(__entry->status, SCAN_STATUS),
84 __entry->unmapped)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080085);
86
87TRACE_EVENT(mm_collapse_huge_page,
88
89 TP_PROTO(struct mm_struct *mm, int isolated, int status),
90
91 TP_ARGS(mm, isolated, status),
92
93 TP_STRUCT__entry(
94 __field(struct mm_struct *, mm)
95 __field(int, isolated)
96 __field(int, status)
97 ),
98
99 TP_fast_assign(
100 __entry->mm = mm;
101 __entry->isolated = isolated;
102 __entry->status = status;
103 ),
104
105 TP_printk("mm=%p, isolated=%d, status=%s",
106 __entry->mm,
107 __entry->isolated,
108 __print_symbolic(__entry->status, SCAN_STATUS))
109);
110
111TRACE_EVENT(mm_collapse_huge_page_isolate,
112
yalin wang16fd0fe2016-01-21 16:40:30 -0800113 TP_PROTO(struct page *page, int none_or_zero,
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700114 int referenced, bool writable, int status),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800115
yalin wang16fd0fe2016-01-21 16:40:30 -0800116 TP_ARGS(page, none_or_zero, referenced, writable, status),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800117
118 TP_STRUCT__entry(
119 __field(unsigned long, pfn)
120 __field(int, none_or_zero)
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700121 __field(int, referenced)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800122 __field(bool, writable)
123 __field(int, status)
124 ),
125
126 TP_fast_assign(
yalin wang16fd0fe2016-01-21 16:40:30 -0800127 __entry->pfn = page ? page_to_pfn(page) : -1;
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800128 __entry->none_or_zero = none_or_zero;
129 __entry->referenced = referenced;
130 __entry->writable = writable;
131 __entry->status = status;
132 ),
133
134 TP_printk("scan_pfn=0x%lx, none_or_zero=%d, referenced=%d, writable=%d, status=%s",
135 __entry->pfn,
136 __entry->none_or_zero,
137 __entry->referenced,
138 __entry->writable,
139 __print_symbolic(__entry->status, SCAN_STATUS))
140);
141
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700142TRACE_EVENT(mm_collapse_huge_page_swapin,
143
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700144 TP_PROTO(struct mm_struct *mm, int swapped_in, int referenced, int ret),
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700145
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700146 TP_ARGS(mm, swapped_in, referenced, ret),
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700147
148 TP_STRUCT__entry(
149 __field(struct mm_struct *, mm)
150 __field(int, swapped_in)
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700151 __field(int, referenced)
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700152 __field(int, ret)
153 ),
154
155 TP_fast_assign(
156 __entry->mm = mm;
157 __entry->swapped_in = swapped_in;
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700158 __entry->referenced = referenced;
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700159 __entry->ret = ret;
160 ),
161
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700162 TP_printk("mm=%p, swapped_in=%d, referenced=%d, ret=%d",
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700163 __entry->mm,
164 __entry->swapped_in,
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700165 __entry->referenced,
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700166 __entry->ret)
167);
168
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800169#endif /* __HUGE_MEMORY_H */
170#include <trace/define_trace.h>