Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 2 | #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 Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 10 | #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. Shutemov | 71a2c11 | 2020-06-03 16:00:30 -0700 | [diff] [blame^] | 15 | EM( SCAN_EXCEED_SWAP_PTE, "exceed_swap_pte") \ |
| 16 | EM( SCAN_EXCEED_SHARED_PTE, "exceed_shared_pte") \ |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 17 | EM( SCAN_PTE_NON_PRESENT, "pte_non_present") \ |
Peter Xu | e1e267c | 2020-04-06 20:06:04 -0700 | [diff] [blame] | 18 | EM( SCAN_PTE_UFFD_WP, "pte_uffd_wp") \ |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 19 | EM( SCAN_PAGE_RO, "no_writable_page") \ |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 20 | EM( SCAN_LACK_REFERENCED_PAGE, "lack_referenced_page") \ |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 21 | 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. Shutemov | b1caa95 | 2016-01-15 16:52:39 -0800 | [diff] [blame] | 27 | EM( SCAN_PAGE_COMPOUND, "page_compound") \ |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 28 | 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 Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 35 | EM( SCAN_CGROUP_CHARGE_FAIL, "ccgroup_charge_failed") \ |
Yang Shi | 554913f | 2020-01-13 16:29:36 -0800 | [diff] [blame] | 36 | EM( SCAN_TRUNCATED, "truncated") \ |
| 37 | EMe(SCAN_PAGE_HAS_PRIVATE, "page_has_private") \ |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 38 | |
| 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 | |
| 44 | SCAN_STATUS |
| 45 | |
| 46 | #undef EM |
| 47 | #undef EMe |
| 48 | #define EM(a, b) {a, b}, |
| 49 | #define EMe(a, b) {a, b} |
| 50 | |
| 51 | TRACE_EVENT(mm_khugepaged_scan_pmd, |
| 52 | |
yalin wang | 16fd0fe | 2016-01-21 16:40:30 -0800 | [diff] [blame] | 53 | TP_PROTO(struct mm_struct *mm, struct page *page, bool writable, |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 54 | int referenced, int none_or_zero, int status, int unmapped), |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 55 | |
Ebru Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 56 | TP_ARGS(mm, page, writable, referenced, none_or_zero, status, unmapped), |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 57 | |
| 58 | TP_STRUCT__entry( |
| 59 | __field(struct mm_struct *, mm) |
| 60 | __field(unsigned long, pfn) |
| 61 | __field(bool, writable) |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 62 | __field(int, referenced) |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 63 | __field(int, none_or_zero) |
| 64 | __field(int, status) |
Ebru Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 65 | __field(int, unmapped) |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 66 | ), |
| 67 | |
| 68 | TP_fast_assign( |
| 69 | __entry->mm = mm; |
yalin wang | 16fd0fe | 2016-01-21 16:40:30 -0800 | [diff] [blame] | 70 | __entry->pfn = page ? page_to_pfn(page) : -1; |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 71 | __entry->writable = writable; |
| 72 | __entry->referenced = referenced; |
| 73 | __entry->none_or_zero = none_or_zero; |
| 74 | __entry->status = status; |
Ebru Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 75 | __entry->unmapped = unmapped; |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 76 | ), |
| 77 | |
Ebru Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 78 | TP_printk("mm=%p, scan_pfn=0x%lx, writable=%d, referenced=%d, none_or_zero=%d, status=%s, unmapped=%d", |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 79 | __entry->mm, |
| 80 | __entry->pfn, |
| 81 | __entry->writable, |
| 82 | __entry->referenced, |
| 83 | __entry->none_or_zero, |
Ebru Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 84 | __print_symbolic(__entry->status, SCAN_STATUS), |
| 85 | __entry->unmapped) |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 86 | ); |
| 87 | |
| 88 | TRACE_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 | |
| 112 | TRACE_EVENT(mm_collapse_huge_page_isolate, |
| 113 | |
yalin wang | 16fd0fe | 2016-01-21 16:40:30 -0800 | [diff] [blame] | 114 | TP_PROTO(struct page *page, int none_or_zero, |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 115 | int referenced, bool writable, int status), |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 116 | |
yalin wang | 16fd0fe | 2016-01-21 16:40:30 -0800 | [diff] [blame] | 117 | TP_ARGS(page, none_or_zero, referenced, writable, status), |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 118 | |
| 119 | TP_STRUCT__entry( |
| 120 | __field(unsigned long, pfn) |
| 121 | __field(int, none_or_zero) |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 122 | __field(int, referenced) |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 123 | __field(bool, writable) |
| 124 | __field(int, status) |
| 125 | ), |
| 126 | |
| 127 | TP_fast_assign( |
yalin wang | 16fd0fe | 2016-01-21 16:40:30 -0800 | [diff] [blame] | 128 | __entry->pfn = page ? page_to_pfn(page) : -1; |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 129 | __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 Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 143 | TRACE_EVENT(mm_collapse_huge_page_swapin, |
| 144 | |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 145 | TP_PROTO(struct mm_struct *mm, int swapped_in, int referenced, int ret), |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 146 | |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 147 | TP_ARGS(mm, swapped_in, referenced, ret), |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 148 | |
| 149 | TP_STRUCT__entry( |
| 150 | __field(struct mm_struct *, mm) |
| 151 | __field(int, swapped_in) |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 152 | __field(int, referenced) |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 153 | __field(int, ret) |
| 154 | ), |
| 155 | |
| 156 | TP_fast_assign( |
| 157 | __entry->mm = mm; |
| 158 | __entry->swapped_in = swapped_in; |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 159 | __entry->referenced = referenced; |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 160 | __entry->ret = ret; |
| 161 | ), |
| 162 | |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 163 | TP_printk("mm=%p, swapped_in=%d, referenced=%d, ret=%d", |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 164 | __entry->mm, |
| 165 | __entry->swapped_in, |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 166 | __entry->referenced, |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 167 | __entry->ret) |
| 168 | ); |
| 169 | |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 170 | #endif /* __HUGE_MEMORY_H */ |
| 171 | #include <trace/define_trace.h> |