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