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") \ |
| 15 | EM( SCAN_PTE_NON_PRESENT, "pte_non_present") \ |
| 16 | EM( SCAN_PAGE_RO, "no_writable_page") \ |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 17 | EM( SCAN_LACK_REFERENCED_PAGE, "lack_referenced_page") \ |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 18 | EM( SCAN_PAGE_NULL, "page_null") \ |
| 19 | EM( SCAN_SCAN_ABORT, "scan_aborted") \ |
| 20 | EM( SCAN_PAGE_COUNT, "not_suitable_page_count") \ |
| 21 | EM( SCAN_PAGE_LRU, "page_not_in_lru") \ |
| 22 | EM( SCAN_PAGE_LOCK, "page_locked") \ |
| 23 | EM( SCAN_PAGE_ANON, "page_not_anon") \ |
Kirill A. Shutemov | b1caa95 | 2016-01-15 16:52:39 -0800 | [diff] [blame] | 24 | EM( SCAN_PAGE_COMPOUND, "page_compound") \ |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 25 | EM( SCAN_ANY_PROCESS, "no_process_for_page") \ |
| 26 | EM( SCAN_VMA_NULL, "vma_null") \ |
| 27 | EM( SCAN_VMA_CHECK, "vma_check_failed") \ |
| 28 | EM( SCAN_ADDRESS_RANGE, "not_suitable_address_range") \ |
| 29 | EM( SCAN_SWAP_CACHE_PAGE, "page_swap_cache") \ |
| 30 | EM( SCAN_DEL_PAGE_LRU, "could_not_delete_page_from_lru")\ |
| 31 | EM( SCAN_ALLOC_HUGE_PAGE_FAIL, "alloc_huge_page_failed") \ |
Ebru Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 32 | EM( SCAN_CGROUP_CHARGE_FAIL, "ccgroup_charge_failed") \ |
Kirill A. Shutemov | f3f0e1d | 2016-07-26 15:26:32 -0700 | [diff] [blame] | 33 | EM( SCAN_EXCEED_SWAP_PTE, "exceed_swap_pte") \ |
| 34 | EMe(SCAN_TRUNCATED, "truncated") \ |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 35 | |
| 36 | #undef EM |
| 37 | #undef EMe |
| 38 | #define EM(a, b) TRACE_DEFINE_ENUM(a); |
| 39 | #define EMe(a, b) TRACE_DEFINE_ENUM(a); |
| 40 | |
| 41 | SCAN_STATUS |
| 42 | |
| 43 | #undef EM |
| 44 | #undef EMe |
| 45 | #define EM(a, b) {a, b}, |
| 46 | #define EMe(a, b) {a, b} |
| 47 | |
| 48 | TRACE_EVENT(mm_khugepaged_scan_pmd, |
| 49 | |
yalin wang | 16fd0fe | 2016-01-21 16:40:30 -0800 | [diff] [blame] | 50 | TP_PROTO(struct mm_struct *mm, struct page *page, bool writable, |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 51 | int referenced, int none_or_zero, int status, int unmapped), |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 52 | |
Ebru Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 53 | TP_ARGS(mm, page, writable, referenced, none_or_zero, status, unmapped), |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 54 | |
| 55 | TP_STRUCT__entry( |
| 56 | __field(struct mm_struct *, mm) |
| 57 | __field(unsigned long, pfn) |
| 58 | __field(bool, writable) |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 59 | __field(int, referenced) |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 60 | __field(int, none_or_zero) |
| 61 | __field(int, status) |
Ebru Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 62 | __field(int, unmapped) |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 63 | ), |
| 64 | |
| 65 | TP_fast_assign( |
| 66 | __entry->mm = mm; |
yalin wang | 16fd0fe | 2016-01-21 16:40:30 -0800 | [diff] [blame] | 67 | __entry->pfn = page ? page_to_pfn(page) : -1; |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 68 | __entry->writable = writable; |
| 69 | __entry->referenced = referenced; |
| 70 | __entry->none_or_zero = none_or_zero; |
| 71 | __entry->status = status; |
Ebru Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 72 | __entry->unmapped = unmapped; |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 73 | ), |
| 74 | |
Ebru Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 75 | 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] | 76 | __entry->mm, |
| 77 | __entry->pfn, |
| 78 | __entry->writable, |
| 79 | __entry->referenced, |
| 80 | __entry->none_or_zero, |
Ebru Akagunduz | 70652f6 | 2016-07-26 15:24:59 -0700 | [diff] [blame] | 81 | __print_symbolic(__entry->status, SCAN_STATUS), |
| 82 | __entry->unmapped) |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 83 | ); |
| 84 | |
| 85 | TRACE_EVENT(mm_collapse_huge_page, |
| 86 | |
| 87 | TP_PROTO(struct mm_struct *mm, int isolated, int status), |
| 88 | |
| 89 | TP_ARGS(mm, isolated, status), |
| 90 | |
| 91 | TP_STRUCT__entry( |
| 92 | __field(struct mm_struct *, mm) |
| 93 | __field(int, isolated) |
| 94 | __field(int, status) |
| 95 | ), |
| 96 | |
| 97 | TP_fast_assign( |
| 98 | __entry->mm = mm; |
| 99 | __entry->isolated = isolated; |
| 100 | __entry->status = status; |
| 101 | ), |
| 102 | |
| 103 | TP_printk("mm=%p, isolated=%d, status=%s", |
| 104 | __entry->mm, |
| 105 | __entry->isolated, |
| 106 | __print_symbolic(__entry->status, SCAN_STATUS)) |
| 107 | ); |
| 108 | |
| 109 | TRACE_EVENT(mm_collapse_huge_page_isolate, |
| 110 | |
yalin wang | 16fd0fe | 2016-01-21 16:40:30 -0800 | [diff] [blame] | 111 | TP_PROTO(struct page *page, int none_or_zero, |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 112 | int referenced, bool writable, int status), |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 113 | |
yalin wang | 16fd0fe | 2016-01-21 16:40:30 -0800 | [diff] [blame] | 114 | TP_ARGS(page, none_or_zero, referenced, writable, status), |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 115 | |
| 116 | TP_STRUCT__entry( |
| 117 | __field(unsigned long, pfn) |
| 118 | __field(int, none_or_zero) |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 119 | __field(int, referenced) |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 120 | __field(bool, writable) |
| 121 | __field(int, status) |
| 122 | ), |
| 123 | |
| 124 | TP_fast_assign( |
yalin wang | 16fd0fe | 2016-01-21 16:40:30 -0800 | [diff] [blame] | 125 | __entry->pfn = page ? page_to_pfn(page) : -1; |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 126 | __entry->none_or_zero = none_or_zero; |
| 127 | __entry->referenced = referenced; |
| 128 | __entry->writable = writable; |
| 129 | __entry->status = status; |
| 130 | ), |
| 131 | |
| 132 | TP_printk("scan_pfn=0x%lx, none_or_zero=%d, referenced=%d, writable=%d, status=%s", |
| 133 | __entry->pfn, |
| 134 | __entry->none_or_zero, |
| 135 | __entry->referenced, |
| 136 | __entry->writable, |
| 137 | __print_symbolic(__entry->status, SCAN_STATUS)) |
| 138 | ); |
| 139 | |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 140 | TRACE_EVENT(mm_collapse_huge_page_swapin, |
| 141 | |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 142 | 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] | 143 | |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 144 | TP_ARGS(mm, swapped_in, referenced, ret), |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 145 | |
| 146 | TP_STRUCT__entry( |
| 147 | __field(struct mm_struct *, mm) |
| 148 | __field(int, swapped_in) |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 149 | __field(int, referenced) |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 150 | __field(int, ret) |
| 151 | ), |
| 152 | |
| 153 | TP_fast_assign( |
| 154 | __entry->mm = mm; |
| 155 | __entry->swapped_in = swapped_in; |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 156 | __entry->referenced = referenced; |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 157 | __entry->ret = ret; |
| 158 | ), |
| 159 | |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 160 | TP_printk("mm=%p, swapped_in=%d, referenced=%d, ret=%d", |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 161 | __entry->mm, |
| 162 | __entry->swapped_in, |
Ebru Akagunduz | 0db501f | 2016-07-26 15:26:46 -0700 | [diff] [blame] | 163 | __entry->referenced, |
Ebru Akagunduz | 8a966ed | 2016-07-26 15:25:03 -0700 | [diff] [blame] | 164 | __entry->ret) |
| 165 | ); |
| 166 | |
Ebru Akagunduz | 7d2eba0 | 2016-01-14 15:22:19 -0800 | [diff] [blame] | 167 | #endif /* __HUGE_MEMORY_H */ |
| 168 | #include <trace/define_trace.h> |