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 <linux/version.h>
12 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
14 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template
,
16 TP_PROTO(unsigned long start_pfn
,
17 unsigned long end_pfn
,
18 unsigned long nr_scanned
,
19 unsigned long nr_taken
),
21 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
),
24 ctf_integer(unsigned long, start_pfn
, start_pfn
)
25 ctf_integer(unsigned long, end_pfn
, end_pfn
)
26 ctf_integer(unsigned long, nr_scanned
, nr_scanned
)
27 ctf_integer(unsigned long, nr_taken
, nr_taken
)
31 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
33 mm_compaction_isolate_migratepages
,
35 compaction_isolate_migratepages
,
37 TP_PROTO(unsigned long start_pfn
,
38 unsigned long end_pfn
,
39 unsigned long nr_scanned
,
40 unsigned long nr_taken
),
42 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
)
45 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
47 mm_compaction_isolate_freepages
,
49 compaction_isolate_freepages
,
51 TP_PROTO(unsigned long start_pfn
,
52 unsigned long end_pfn
,
53 unsigned long nr_scanned
,
54 unsigned long nr_taken
),
56 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
)
59 #else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */
61 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template
,
63 TP_PROTO(unsigned long nr_scanned
,
64 unsigned long nr_taken
),
66 TP_ARGS(nr_scanned
, nr_taken
),
69 ctf_integer(unsigned long, nr_scanned
, nr_scanned
)
70 ctf_integer(unsigned long, nr_taken
, nr_taken
)
74 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
76 mm_compaction_isolate_migratepages
,
78 compaction_isolate_migratepages
,
80 TP_PROTO(unsigned long nr_scanned
,
81 unsigned long nr_taken
),
83 TP_ARGS(nr_scanned
, nr_taken
)
86 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
88 mm_compaction_isolate_freepages
,
90 compaction_isolate_freepages
,
92 TP_PROTO(unsigned long nr_scanned
,
93 unsigned long nr_taken
),
95 TP_ARGS(nr_scanned
, nr_taken
)
98 #endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */
100 #if LTTNG_KERNEL_RANGE(3,12,30, 3,13,0) || \
101 LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \
102 (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
103 LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages
,
105 compaction_migratepages
,
107 TP_PROTO(unsigned long nr_all
,
109 struct list_head
*migratepages
),
111 TP_ARGS(nr_all
, migrate_rc
, migratepages
),
114 unsigned long nr_failed
;
118 tp_locvar
->nr_failed
= 0;
121 struct list_head
*page_lru
;
124 tp_locvar
->nr_failed
= migrate_rc
;
126 list_for_each(page_lru
, migratepages
)
127 tp_locvar
->nr_failed
++;
132 ctf_integer(unsigned long, nr_migrated
, nr_all
- tp_locvar
->nr_failed
)
133 ctf_integer(unsigned long, nr_failed
, tp_locvar
->nr_failed
)
138 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
139 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages
,
141 compaction_migratepages
,
143 TP_PROTO(unsigned long nr_migrated
,
144 unsigned long nr_failed
),
146 TP_ARGS(nr_migrated
, nr_failed
),
149 ctf_integer(unsigned long, nr_migrated
, nr_migrated
)
150 ctf_integer(unsigned long, nr_failed
, nr_failed
)
153 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
155 #endif /* LTTNG_TRACE_COMPACTION_H */
157 /* This part must be outside protection */
158 #include <lttng/define_trace.h>