1 /* SPDX-License-Identifier: GPL-2.0 */ 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 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_PTE_UFFD_WP, "pte_uffd_wp") \ 17 EM( SCAN_PAGE_RO, "no_writable_page") \ 18 EM( SCAN_LACK_REFERENCED_PAGE, "lack_referenced_page") \ 19 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") \ 25 EM( SCAN_PAGE_COMPOUND, "page_compound") \ 26 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") \ 33 EM( SCAN_CGROUP_CHARGE_FAIL, "ccgroup_charge_failed") \ 34 EM( SCAN_EXCEED_SWAP_PTE, "exceed_swap_pte") \ 35 EM( SCAN_TRUNCATED, "truncated") \ 36 EMe(SCAN_PAGE_HAS_PRIVATE, "page_has_private") \ 37 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 43 SCAN_STATUS 44 45 #undef EM 46 #undef EMe 47 #define EM(a, b) {a, b}, 48 #define EMe(a, b) {a, b} 49 50 TRACE_EVENT(mm_khugepaged_scan_pmd, 51 52 TP_PROTO(struct mm_struct *mm, struct page *page, bool writable, 53 int referenced, int none_or_zero, int status, int unmapped), 54 55 TP_ARGS(mm, page, writable, referenced, none_or_zero, status, unmapped), 56 57 TP_STRUCT__entry( 58 __field(struct mm_struct *, mm) 59 __field(unsigned long, pfn) 60 __field(bool, writable) 61 __field(int, referenced) 62 __field(int, none_or_zero) 63 __field(int, status) 64 __field(int, unmapped) 65 ), 66 67 TP_fast_assign( 68 __entry->mm = mm; 69 __entry->pfn = page ? page_to_pfn(page) : -1; 70 __entry->writable = writable; 71 __entry->referenced = referenced; 72 __entry->none_or_zero = none_or_zero; 73 __entry->status = status; 74 __entry->unmapped = unmapped; 75 ), 76 77 TP_printk("mm=%p, scan_pfn=0x%lx, writable=%d, referenced=%d, none_or_zero=%d, status=%s, unmapped=%d", 78 __entry->mm, 79 __entry->pfn, 80 __entry->writable, 81 __entry->referenced, 82 __entry->none_or_zero, 83 __print_symbolic(__entry->status, SCAN_STATUS), 84 __entry->unmapped) 85 ); 86 87 TRACE_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 111 TRACE_EVENT(mm_collapse_huge_page_isolate, 112 113 TP_PROTO(struct page *page, int none_or_zero, 114 int referenced, bool writable, int status), 115 116 TP_ARGS(page, none_or_zero, referenced, writable, status), 117 118 TP_STRUCT__entry( 119 __field(unsigned long, pfn) 120 __field(int, none_or_zero) 121 __field(int, referenced) 122 __field(bool, writable) 123 __field(int, status) 124 ), 125 126 TP_fast_assign( 127 __entry->pfn = page ? page_to_pfn(page) : -1; 128 __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 142 TRACE_EVENT(mm_collapse_huge_page_swapin, 143 144 TP_PROTO(struct mm_struct *mm, int swapped_in, int referenced, int ret), 145 146 TP_ARGS(mm, swapped_in, referenced, ret), 147 148 TP_STRUCT__entry( 149 __field(struct mm_struct *, mm) 150 __field(int, swapped_in) 151 __field(int, referenced) 152 __field(int, ret) 153 ), 154 155 TP_fast_assign( 156 __entry->mm = mm; 157 __entry->swapped_in = swapped_in; 158 __entry->referenced = referenced; 159 __entry->ret = ret; 160 ), 161 162 TP_printk("mm=%p, swapped_in=%d, referenced=%d, ret=%d", 163 __entry->mm, 164 __entry->swapped_in, 165 __entry->referenced, 166 __entry->ret) 167 ); 168 169 #endif /* __HUGE_MEMORY_H */ 170 #include <trace/define_trace.h> 171