fix: mm: compaction: fix the migration stats in trace_mm_compaction_migratepages...
[lttng-modules.git] / include / instrumentation / events / compaction.h
CommitLineData
b7cdc182 1/* SPDX-License-Identifier: GPL-2.0-only */
b87700e3
AG
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM compaction
4
3bc29f0a
MD
5#if !defined(LTTNG_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
6#define LTTNG_TRACE_COMPACTION_H
b87700e3 7
3b4aafcb 8#include <lttng/tracepoint-event.h>
b87700e3 9#include <linux/types.h>
5f4c791e 10#include <lttng/kernel-version.h>
b87700e3 11
5f4c791e 12#if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0)
a57f014e 13
9bbf98da 14LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template,
a57f014e
MD
15
16 TP_PROTO(unsigned long start_pfn,
17 unsigned long end_pfn,
18 unsigned long nr_scanned,
19 unsigned long nr_taken),
20
21 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken),
22
f127e61e
MD
23 TP_FIELDS(
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)
28 )
a57f014e
MD
29)
30
c3857419
MD
31LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
32
33 mm_compaction_isolate_migratepages,
34
35 compaction_isolate_migratepages,
a57f014e
MD
36
37 TP_PROTO(unsigned long start_pfn,
38 unsigned long end_pfn,
39 unsigned long nr_scanned,
40 unsigned long nr_taken),
41
42 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
43)
44
c3857419
MD
45LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
46
47 mm_compaction_isolate_freepages,
48
49 compaction_isolate_freepages,
a57f014e
MD
50
51 TP_PROTO(unsigned long start_pfn,
52 unsigned long end_pfn,
53 unsigned long nr_scanned,
54 unsigned long nr_taken),
55
56 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
57)
58
5f4c791e 59#else /* #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */
a57f014e 60
9bbf98da 61LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template,
b87700e3
AG
62
63 TP_PROTO(unsigned long nr_scanned,
64 unsigned long nr_taken),
65
66 TP_ARGS(nr_scanned, nr_taken),
67
f127e61e
MD
68 TP_FIELDS(
69 ctf_integer(unsigned long, nr_scanned, nr_scanned)
70 ctf_integer(unsigned long, nr_taken, nr_taken)
71 )
b87700e3
AG
72)
73
9bbf98da
MD
74LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
75
76 mm_compaction_isolate_migratepages,
77
78 compaction_isolate_migratepages,
b87700e3
AG
79
80 TP_PROTO(unsigned long nr_scanned,
81 unsigned long nr_taken),
82
83 TP_ARGS(nr_scanned, nr_taken)
84)
85
9bbf98da
MD
86LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
87
88 mm_compaction_isolate_freepages,
89
90 compaction_isolate_freepages,
91
b87700e3
AG
92 TP_PROTO(unsigned long nr_scanned,
93 unsigned long nr_taken),
94
95 TP_ARGS(nr_scanned, nr_taken)
96)
97
5f4c791e 98#endif /* #else #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */
a57f014e 99
afc4fe89
MJ
100#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
101LTTNG_TRACEPOINT_EVENT(mm_compaction_migratepages,
102
103 TP_PROTO(unsigned long nr_all,
104 unsigned int nr_succeeded),
105
106 TP_ARGS(nr_all, nr_succeeded),
107
108 TP_FIELDS(
109 ctf_integer(unsigned long, nr_migrated, nr_succeeded)
110 ctf_integer(unsigned long, nr_failed, nr_all - nr_succeeded)
111 )
112)
113#elif LTTNG_KERNEL_RANGE(3,12,30, 3,13,0) || \
24ce932c 114 LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \
5f4c791e 115 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,16,0))
f127e61e 116LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages,
9bbf98da
MD
117
118 compaction_migratepages,
00073447
MD
119
120 TP_PROTO(unsigned long nr_all,
121 int migrate_rc,
122 struct list_head *migratepages),
123
124 TP_ARGS(nr_all, migrate_rc, migratepages),
125
f127e61e
MD
126 TP_locvar(
127 unsigned long nr_failed;
00073447
MD
128 ),
129
265822ae 130 TP_code_pre(
f127e61e
MD
131 tp_locvar->nr_failed = 0;
132
133 {
134 struct list_head *page_lru;
135
136 if (migrate_rc >= 0)
137 tp_locvar->nr_failed = migrate_rc;
138 else
139 list_for_each(page_lru, migratepages)
140 tp_locvar->nr_failed++;
141 }
00073447
MD
142 ),
143
f127e61e
MD
144 TP_FIELDS(
145 ctf_integer(unsigned long, nr_migrated, nr_all - tp_locvar->nr_failed)
146 ctf_integer(unsigned long, nr_failed, tp_locvar->nr_failed)
265822ae
MD
147 ),
148
149 TP_code_post()
00073447 150)
5f4c791e 151#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,16,0)) */
9bbf98da
MD
152LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
153
154 compaction_migratepages,
b87700e3
AG
155
156 TP_PROTO(unsigned long nr_migrated,
157 unsigned long nr_failed),
158
159 TP_ARGS(nr_migrated, nr_failed),
160
f127e61e
MD
161 TP_FIELDS(
162 ctf_integer(unsigned long, nr_migrated, nr_migrated)
163 ctf_integer(unsigned long, nr_failed, nr_failed)
164 )
b87700e3 165)
5f4c791e 166#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,16,0)) */
b87700e3 167
3bc29f0a 168#endif /* LTTNG_TRACE_COMPACTION_H */
b87700e3
AG
169
170/* This part must be outside protection */
3b4aafcb 171#include <lttng/define_trace.h>
This page took 0.080222 seconds and 4 git commands to generate.