blob: 4fdb14a81108baad7845d8b1156e43621530769c [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") \
Kirill A. Shutemov71a2c112020-06-03 16:00:30 -070015 EM( SCAN_EXCEED_SWAP_PTE, "exceed_swap_pte") \
16 EM( SCAN_EXCEED_SHARED_PTE, "exceed_shared_pte") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080017 EM( SCAN_PTE_NON_PRESENT, "pte_non_present") \
Peter Xue1e267c2020-04-06 20:06:04 -070018 EM( SCAN_PTE_UFFD_WP, "pte_uffd_wp") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080019 EM( SCAN_PAGE_RO, "no_writable_page") \
Ebru Akagunduz0db501f2016-07-26 15:26:46 -070020 EM( SCAN_LACK_REFERENCED_PAGE, "lack_referenced_page") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080021 EM( SCAN_PAGE_NULL, "page_null") \
22 EM( SCAN_SCAN_ABORT, "scan_aborted") \
23 EM( SCAN_PAGE_COUNT, "not_suitable_page_count") \
24 EM( SCAN_PAGE_LRU, "page_not_in_lru") \
25 EM( SCAN_PAGE_LOCK, "page_locked") \
26 EM( SCAN_PAGE_ANON, "page_not_anon") \
Kirill A. Shutemovb1caa952016-01-15 16:52:39 -080027 EM( SCAN_PAGE_COMPOUND, "page_compound") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080028 EM( SCAN_ANY_PROCESS, "no_process_for_page") \
29 EM( SCAN_VMA_NULL, "vma_null") \
30 EM( SCAN_VMA_CHECK, "vma_check_failed") \
31 EM( SCAN_ADDRESS_RANGE, "not_suitable_address_range") \
32 EM( SCAN_SWAP_CACHE_PAGE, "page_swap_cache") \
33 EM( SCAN_DEL_PAGE_LRU, "could_not_delete_page_from_lru")\
34 EM( SCAN_ALLOC_HUGE_PAGE_FAIL, "alloc_huge_page_failed") \
Ebru Akagunduz70652f62016-07-26 15:24:59 -070035 EM( SCAN_CGROUP_CHARGE_FAIL, "ccgroup_charge_failed") \
Yang Shi554913f2020-01-13 16:29:36 -080036 EM( SCAN_TRUNCATED, "truncated") \
37 EMe(SCAN_PAGE_HAS_PRIVATE, "page_has_private") \
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080038
39#undef EM
40#undef EMe
41#define EM(a, b) TRACE_DEFINE_ENUM(a);
42#define EMe(a, b) TRACE_DEFINE_ENUM(a);
43
44SCAN_STATUS
45
46#undef EM
47#undef EMe
48#define EM(a, b) {a, b},
49#define EMe(a, b) {a, b}
50
51TRACE_EVENT(mm_khugepaged_scan_pmd,
52
yalin wang16fd0fe2016-01-21 16:40:30 -080053 TP_PROTO(struct mm_struct *mm, struct page *page, bool writable,
Ebru Akagunduz0db501f2016-07-26 15:26:46 -070054 int referenced, int none_or_zero, int status, int unmapped),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080055
Ebru Akagunduz70652f62016-07-26 15:24:59 -070056 TP_ARGS(mm, page, writable, referenced, none_or_zero, status, unmapped),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080057
58 TP_STRUCT__entry(
59 __field(struct mm_struct *, mm)
60 __field(unsigned long, pfn)
61 __field(bool, writable)
Ebru Akagunduz0db501f2016-07-26 15:26:46 -070062 __field(int, referenced)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080063 __field(int, none_or_zero)
64 __field(int, status)
Ebru Akagunduz70652f62016-07-26 15:24:59 -070065 __field(int, unmapped)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080066 ),
67
68 TP_fast_assign(
69 __entry->mm = mm;
yalin wang16fd0fe2016-01-21 16:40:30 -080070 __entry->pfn = page ? page_to_pfn(page) : -1;
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080071 __entry->writable = writable;
72 __entry->referenced = referenced;
73 __entry->none_or_zero = none_or_zero;
74 __entry->status = status;
Ebru Akagunduz70652f62016-07-26 15:24:59 -070075 __entry->unmapped = unmapped;
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080076 ),
77
Ebru Akagunduz70652f62016-07-26 15:24:59 -070078 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 -080079 __entry->mm,
80 __entry->pfn,
81 __entry->writable,
82 __entry->referenced,
83 __entry->none_or_zero,
Ebru Akagunduz70652f62016-07-26 15:24:59 -070084 __print_symbolic(__entry->status, SCAN_STATUS),
85 __entry->unmapped)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -080086);
87
88TRACE_EVENT(mm_collapse_huge_page,
89
90 TP_PROTO(struct mm_struct *mm, int isolated, int status),
91
92 TP_ARGS(mm, isolated, status),
93
94 TP_STRUCT__entry(
95 __field(struct mm_struct *, mm)
96 __field(int, isolated)
97 __field(int, status)
98 ),
99
100 TP_fast_assign(
101 __entry->mm = mm;
102 __entry->isolated = isolated;
103 __entry->status = status;
104 ),
105
106 TP_printk("mm=%p, isolated=%d, status=%s",
107 __entry->mm,
108 __entry->isolated,
109 __print_symbolic(__entry->status, SCAN_STATUS))
110);
111
112TRACE_EVENT(mm_collapse_huge_page_isolate,
113
yalin wang16fd0fe2016-01-21 16:40:30 -0800114 TP_PROTO(struct page *page, int none_or_zero,
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700115 int referenced, bool writable, int status),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800116
yalin wang16fd0fe2016-01-21 16:40:30 -0800117 TP_ARGS(page, none_or_zero, referenced, writable, status),
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800118
119 TP_STRUCT__entry(
120 __field(unsigned long, pfn)
121 __field(int, none_or_zero)
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700122 __field(int, referenced)
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800123 __field(bool, writable)
124 __field(int, status)
125 ),
126
127 TP_fast_assign(
yalin wang16fd0fe2016-01-21 16:40:30 -0800128 __entry->pfn = page ? page_to_pfn(page) : -1;
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800129 __entry->none_or_zero = none_or_zero;
130 __entry->referenced = referenced;
131 __entry->writable = writable;
132 __entry->status = status;
133 ),
134
135 TP_printk("scan_pfn=0x%lx, none_or_zero=%d, referenced=%d, writable=%d, status=%s",
136 __entry->pfn,
137 __entry->none_or_zero,
138 __entry->referenced,
139 __entry->writable,
140 __print_symbolic(__entry->status, SCAN_STATUS))
141);
142
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700143TRACE_EVENT(mm_collapse_huge_page_swapin,
144
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700145 TP_PROTO(struct mm_struct *mm, int swapped_in, int referenced, int ret),
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700146
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700147 TP_ARGS(mm, swapped_in, referenced, ret),
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700148
149 TP_STRUCT__entry(
150 __field(struct mm_struct *, mm)
151 __field(int, swapped_in)
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700152 __field(int, referenced)
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700153 __field(int, ret)
154 ),
155
156 TP_fast_assign(
157 __entry->mm = mm;
158 __entry->swapped_in = swapped_in;
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700159 __entry->referenced = referenced;
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700160 __entry->ret = ret;
161 ),
162
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700163 TP_printk("mm=%p, swapped_in=%d, referenced=%d, ret=%d",
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700164 __entry->mm,
165 __entry->swapped_in,
Ebru Akagunduz0db501f2016-07-26 15:26:46 -0700166 __entry->referenced,
Ebru Akagunduz8a966ed2016-07-26 15:25:03 -0700167 __entry->ret)
168);
169
Ebru Akagunduz7d2eba02016-01-14 15:22:19 -0800170#endif /* __HUGE_MEMORY_H */
171#include <trace/define_trace.h>