1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #define TRACE_SYSTEM compaction
5 #if !defined(LTTNG_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_COMPACTION_H
8 #include <lttng/tracepoint-event.h>
9 #include <linux/types.h>
10 #include <lttng/kernel-version.h>
12 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template
,
14 TP_PROTO(unsigned long start_pfn
,
15 unsigned long end_pfn
,
16 unsigned long nr_scanned
,
17 unsigned long nr_taken
),
19 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
),
22 ctf_integer(unsigned long, start_pfn
, start_pfn
)
23 ctf_integer(unsigned long, end_pfn
, end_pfn
)
24 ctf_integer(unsigned long, nr_scanned
, nr_scanned
)
25 ctf_integer(unsigned long, nr_taken
, nr_taken
)
29 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
31 mm_compaction_isolate_migratepages
,
33 compaction_isolate_migratepages
,
35 TP_PROTO(unsigned long start_pfn
,
36 unsigned long end_pfn
,
37 unsigned long nr_scanned
,
38 unsigned long nr_taken
),
40 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
)
43 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
45 mm_compaction_isolate_freepages
,
47 compaction_isolate_freepages
,
49 TP_PROTO(unsigned long start_pfn
,
50 unsigned long end_pfn
,
51 unsigned long nr_scanned
,
52 unsigned long nr_taken
),
54 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
)
57 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0) || \
58 LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
59 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages
,
61 compaction_migratepages
,
63 TP_PROTO(struct compact_control
*cc
,
64 unsigned int nr_succeeded
),
66 TP_ARGS(cc
, nr_succeeded
),
69 ctf_integer(unsigned long, nr_migrated
, nr_succeeded
)
70 ctf_integer(unsigned long, nr_failed
, cc
->nr_migratepages
- nr_succeeded
)
73 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
74 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages
,
76 compaction_migratepages
,
78 TP_PROTO(unsigned long nr_all
,
79 unsigned int nr_succeeded
),
81 TP_ARGS(nr_all
, nr_succeeded
),
84 ctf_integer(unsigned long, nr_migrated
, nr_succeeded
)
85 ctf_integer(unsigned long, nr_failed
, nr_all
- nr_succeeded
)
89 LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages
,
91 compaction_migratepages
,
93 TP_PROTO(unsigned long nr_all
,
95 struct list_head
*migratepages
),
97 TP_ARGS(nr_all
, migrate_rc
, migratepages
),
100 unsigned long nr_failed
;
104 tp_locvar
->nr_failed
= 0;
107 struct list_head
*page_lru
;
110 tp_locvar
->nr_failed
= migrate_rc
;
112 list_for_each(page_lru
, migratepages
)
113 tp_locvar
->nr_failed
++;
118 ctf_integer(unsigned long, nr_migrated
, nr_all
- tp_locvar
->nr_failed
)
119 ctf_integer(unsigned long, nr_failed
, tp_locvar
->nr_failed
)
124 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,16,0)) */
126 #endif /* LTTNG_TRACE_COMPACTION_H */
128 /* This part must be outside protection */
129 #include <lttng/define_trace.h>