1 // SPDX-FileCopyrightText: 2012 Andrew Gabbasov <andrew_gabbasov@mentor.com>
3 // SPDX-License-Identifier: GPL-2.0-only
6 #define TRACE_SYSTEM compaction
8 #if !defined(LTTNG_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define LTTNG_TRACE_COMPACTION_H
11 #include <lttng/tracepoint-event.h>
12 #include <linux/types.h>
13 #include <lttng/kernel-version.h>
15 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template
,
17 TP_PROTO(unsigned long start_pfn
,
18 unsigned long end_pfn
,
19 unsigned long nr_scanned
,
20 unsigned long nr_taken
),
22 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
),
25 ctf_integer(unsigned long, start_pfn
, start_pfn
)
26 ctf_integer(unsigned long, end_pfn
, end_pfn
)
27 ctf_integer(unsigned long, nr_scanned
, nr_scanned
)
28 ctf_integer(unsigned long, nr_taken
, nr_taken
)
32 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
34 mm_compaction_isolate_migratepages
,
36 compaction_isolate_migratepages
,
38 TP_PROTO(unsigned long start_pfn
,
39 unsigned long end_pfn
,
40 unsigned long nr_scanned
,
41 unsigned long nr_taken
),
43 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
)
46 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
48 mm_compaction_isolate_freepages
,
50 compaction_isolate_freepages
,
52 TP_PROTO(unsigned long start_pfn
,
53 unsigned long end_pfn
,
54 unsigned long nr_scanned
,
55 unsigned long nr_taken
),
57 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
)
60 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,9,0))
61 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages
,
63 compaction_migratepages
,
65 TP_PROTO(unsigned int nr_migratepages
,
66 unsigned int nr_succeeded
),
68 TP_ARGS(nr_migratepages
, nr_succeeded
),
71 ctf_integer(unsigned long, nr_migrated
, nr_succeeded
)
72 ctf_integer(unsigned long, nr_failed
, nr_migratepages
- nr_succeeded
)
75 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0) || \
76 LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
77 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages
,
79 compaction_migratepages
,
81 TP_PROTO(struct compact_control
*cc
,
82 unsigned int nr_succeeded
),
84 TP_ARGS(cc
, nr_succeeded
),
87 ctf_integer(unsigned long, nr_migrated
, nr_succeeded
)
88 ctf_integer(unsigned long, nr_failed
, cc
->nr_migratepages
- nr_succeeded
)
91 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
92 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages
,
94 compaction_migratepages
,
96 TP_PROTO(unsigned long nr_all
,
97 unsigned int nr_succeeded
),
99 TP_ARGS(nr_all
, nr_succeeded
),
102 ctf_integer(unsigned long, nr_migrated
, nr_succeeded
)
103 ctf_integer(unsigned long, nr_failed
, nr_all
- nr_succeeded
)
107 LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages
,
109 compaction_migratepages
,
111 TP_PROTO(unsigned long nr_all
,
113 struct list_head
*migratepages
),
115 TP_ARGS(nr_all
, migrate_rc
, migratepages
),
118 unsigned long nr_failed
;
122 tp_locvar
->nr_failed
= 0;
125 struct list_head
*page_lru
;
128 tp_locvar
->nr_failed
= migrate_rc
;
130 list_for_each(page_lru
, migratepages
)
131 tp_locvar
->nr_failed
++;
136 ctf_integer(unsigned long, nr_migrated
, nr_all
- tp_locvar
->nr_failed
)
137 ctf_integer(unsigned long, nr_failed
, tp_locvar
->nr_failed
)
142 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,16,0)) */
144 #endif /* LTTNG_TRACE_COMPACTION_H */
146 /* This part must be outside protection */
147 #include <lttng/define_trace.h>