31d0a422e52418290403bd92fcc45b554c6a8f8c
[lttng-modules.git] / include / instrumentation / events / compaction.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM compaction
4
5 #if !defined(LTTNG_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_COMPACTION_H
7
8 #include <lttng/tracepoint-event.h>
9 #include <linux/types.h>
10 #include <lttng/kernel-version.h>
11
12 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template,
13
14 TP_PROTO(unsigned long start_pfn,
15 unsigned long end_pfn,
16 unsigned long nr_scanned,
17 unsigned long nr_taken),
18
19 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken),
20
21 TP_FIELDS(
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)
26 )
27 )
28
29 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
30
31 mm_compaction_isolate_migratepages,
32
33 compaction_isolate_migratepages,
34
35 TP_PROTO(unsigned long start_pfn,
36 unsigned long end_pfn,
37 unsigned long nr_scanned,
38 unsigned long nr_taken),
39
40 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
41 )
42
43 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
44
45 mm_compaction_isolate_freepages,
46
47 compaction_isolate_freepages,
48
49 TP_PROTO(unsigned long start_pfn,
50 unsigned long end_pfn,
51 unsigned long nr_scanned,
52 unsigned long nr_taken),
53
54 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
55 )
56
57 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
58 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
59
60 compaction_migratepages,
61
62 TP_PROTO(struct compact_control *cc,
63 unsigned int nr_succeeded),
64
65 TP_ARGS(cc, nr_succeeded),
66
67 TP_FIELDS(
68 ctf_integer(unsigned long, nr_migrated, nr_succeeded)
69 ctf_integer(unsigned long, nr_failed, cc->nr_migratepages - nr_succeeded)
70 )
71 )
72 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
73 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
74
75 compaction_migratepages,
76
77 TP_PROTO(unsigned long nr_all,
78 unsigned int nr_succeeded),
79
80 TP_ARGS(nr_all, nr_succeeded),
81
82 TP_FIELDS(
83 ctf_integer(unsigned long, nr_migrated, nr_succeeded)
84 ctf_integer(unsigned long, nr_failed, nr_all - nr_succeeded)
85 )
86 )
87 #else
88 LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages,
89
90 compaction_migratepages,
91
92 TP_PROTO(unsigned long nr_all,
93 int migrate_rc,
94 struct list_head *migratepages),
95
96 TP_ARGS(nr_all, migrate_rc, migratepages),
97
98 TP_locvar(
99 unsigned long nr_failed;
100 ),
101
102 TP_code_pre(
103 tp_locvar->nr_failed = 0;
104
105 {
106 struct list_head *page_lru;
107
108 if (migrate_rc >= 0)
109 tp_locvar->nr_failed = migrate_rc;
110 else
111 list_for_each(page_lru, migratepages)
112 tp_locvar->nr_failed++;
113 }
114 ),
115
116 TP_FIELDS(
117 ctf_integer(unsigned long, nr_migrated, nr_all - tp_locvar->nr_failed)
118 ctf_integer(unsigned long, nr_failed, tp_locvar->nr_failed)
119 ),
120
121 TP_code_post()
122 )
123 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,16,0)) */
124
125 #endif /* LTTNG_TRACE_COMPACTION_H */
126
127 /* This part must be outside protection */
128 #include <lttng/define_trace.h>
This page took 0.033419 seconds and 3 git commands to generate.