1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM huge_memory
5 #if !defined(__HUGE_MEMORY_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define __HUGE_MEMORY_H
8 #include <linux/tracepoint.h>
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_EXCEED_SWAP_PTE, "exceed_swap_pte") \
16 EM( SCAN_EXCEED_SHARED_PTE, "exceed_shared_pte") \
17 EM( SCAN_PTE_NON_PRESENT, "pte_non_present") \
18 EM( SCAN_PTE_UFFD_WP, "pte_uffd_wp") \
19 EM( SCAN_PAGE_RO, "no_writable_page") \
20 EM( SCAN_LACK_REFERENCED_PAGE, "lack_referenced_page") \
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") \
27 EM( SCAN_PAGE_COMPOUND, "page_compound") \
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") \
35 EM( SCAN_CGROUP_CHARGE_FAIL, "ccgroup_charge_failed") \
36 EM( SCAN_TRUNCATED, "truncated") \
37 EMe(SCAN_PAGE_HAS_PRIVATE, "page_has_private") \
41 #define EM(a, b) TRACE_DEFINE_ENUM(a);
42 #define EMe(a, b) TRACE_DEFINE_ENUM(a);
48 #define EM(a, b) {a, b},
49 #define EMe(a, b) {a, b}
51 TRACE_EVENT(mm_khugepaged_scan_pmd
,
53 TP_PROTO(struct mm_struct
*mm
, struct page
*page
, bool writable
,
54 int referenced
, int none_or_zero
, int status
, int unmapped
),
56 TP_ARGS(mm
, page
, writable
, referenced
, none_or_zero
, status
, unmapped
),
59 __field(struct mm_struct
*, mm
)
60 __field(unsigned long, pfn
)
61 __field(bool, writable
)
62 __field(int, referenced
)
63 __field(int, none_or_zero
)
65 __field(int, unmapped
)
70 __entry
->pfn
= page
? page_to_pfn(page
) : -1;
71 __entry
->writable
= writable
;
72 __entry
->referenced
= referenced
;
73 __entry
->none_or_zero
= none_or_zero
;
74 __entry
->status
= status
;
75 __entry
->unmapped
= unmapped
;
78 TP_printk("mm=%p, scan_pfn=0x%lx, writable=%d, referenced=%d, none_or_zero=%d, status=%s, unmapped=%d",
83 __entry
->none_or_zero
,
84 __print_symbolic(__entry
->status
, SCAN_STATUS
),
88 TRACE_EVENT(mm_collapse_huge_page
,
90 TP_PROTO(struct mm_struct
*mm
, int isolated
, int status
),
92 TP_ARGS(mm
, isolated
, status
),
95 __field(struct mm_struct
*, mm
)
96 __field(int, isolated
)
102 __entry
->isolated
= isolated
;
103 __entry
->status
= status
;
106 TP_printk("mm=%p, isolated=%d, status=%s",
109 __print_symbolic(__entry
->status
, SCAN_STATUS
))
112 TRACE_EVENT(mm_collapse_huge_page_isolate
,
114 TP_PROTO(struct page
*page
, int none_or_zero
,
115 int referenced
, bool writable
, int status
),
117 TP_ARGS(page
, none_or_zero
, referenced
, writable
, status
),
120 __field(unsigned long, pfn
)
121 __field(int, none_or_zero
)
122 __field(int, referenced
)
123 __field(bool, writable
)
128 __entry
->pfn
= page
? page_to_pfn(page
) : -1;
129 __entry
->none_or_zero
= none_or_zero
;
130 __entry
->referenced
= referenced
;
131 __entry
->writable
= writable
;
132 __entry
->status
= status
;
135 TP_printk("scan_pfn=0x%lx, none_or_zero=%d, referenced=%d, writable=%d, status=%s",
137 __entry
->none_or_zero
,
140 __print_symbolic(__entry
->status
, SCAN_STATUS
))
143 TRACE_EVENT(mm_collapse_huge_page_swapin
,
145 TP_PROTO(struct mm_struct
*mm
, int swapped_in
, int referenced
, int ret
),
147 TP_ARGS(mm
, swapped_in
, referenced
, ret
),
150 __field(struct mm_struct
*, mm
)
151 __field(int, swapped_in
)
152 __field(int, referenced
)
158 __entry
->swapped_in
= swapped_in
;
159 __entry
->referenced
= referenced
;
163 TP_printk("mm=%p, swapped_in=%d, referenced=%d, ret=%d",
170 #endif /* __HUGE_MEMORY_H */
171 #include <trace/define_trace.h>