2 #define TRACE_SYSTEM compaction
4 #if !defined(LTTNG_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_COMPACTION_H
7 #include <probes/lttng-tracepoint-event.h>
8 #include <linux/types.h>
9 #include <linux/version.h>
11 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
13 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template
,
15 TP_PROTO(unsigned long start_pfn
,
16 unsigned long end_pfn
,
17 unsigned long nr_scanned
,
18 unsigned long nr_taken
),
20 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
),
23 ctf_integer(unsigned long, start_pfn
, start_pfn
)
24 ctf_integer(unsigned long, end_pfn
, end_pfn
)
25 ctf_integer(unsigned long, nr_scanned
, nr_scanned
)
26 ctf_integer(unsigned long, nr_taken
, nr_taken
)
30 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
32 mm_compaction_isolate_migratepages
,
34 compaction_isolate_migratepages
,
36 TP_PROTO(unsigned long start_pfn
,
37 unsigned long end_pfn
,
38 unsigned long nr_scanned
,
39 unsigned long nr_taken
),
41 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
)
44 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
46 mm_compaction_isolate_freepages
,
48 compaction_isolate_freepages
,
50 TP_PROTO(unsigned long start_pfn
,
51 unsigned long end_pfn
,
52 unsigned long nr_scanned
,
53 unsigned long nr_taken
),
55 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
)
58 #else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */
60 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template
,
62 TP_PROTO(unsigned long nr_scanned
,
63 unsigned long nr_taken
),
65 TP_ARGS(nr_scanned
, nr_taken
),
68 ctf_integer(unsigned long, nr_scanned
, nr_scanned
)
69 ctf_integer(unsigned long, nr_taken
, nr_taken
)
73 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
75 mm_compaction_isolate_migratepages
,
77 compaction_isolate_migratepages
,
79 TP_PROTO(unsigned long nr_scanned
,
80 unsigned long nr_taken
),
82 TP_ARGS(nr_scanned
, nr_taken
)
85 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template
,
87 mm_compaction_isolate_freepages
,
89 compaction_isolate_freepages
,
91 TP_PROTO(unsigned long nr_scanned
,
92 unsigned long nr_taken
),
94 TP_ARGS(nr_scanned
, nr_taken
)
97 #endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */
99 #if LTTNG_KERNEL_RANGE(3,12,30, 3,13,0) || \
100 LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \
101 (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
102 LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages
,
104 compaction_migratepages
,
106 TP_PROTO(unsigned long nr_all
,
108 struct list_head
*migratepages
),
110 TP_ARGS(nr_all
, migrate_rc
, migratepages
),
113 unsigned long nr_failed
;
117 tp_locvar
->nr_failed
= 0;
120 struct list_head
*page_lru
;
123 tp_locvar
->nr_failed
= migrate_rc
;
125 list_for_each(page_lru
, migratepages
)
126 tp_locvar
->nr_failed
++;
131 ctf_integer(unsigned long, nr_migrated
, nr_all
- tp_locvar
->nr_failed
)
132 ctf_integer(unsigned long, nr_failed
, tp_locvar
->nr_failed
)
137 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
138 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages
,
140 compaction_migratepages
,
142 TP_PROTO(unsigned long nr_migrated
,
143 unsigned long nr_failed
),
145 TP_ARGS(nr_migrated
, nr_failed
),
148 ctf_integer(unsigned long, nr_migrated
, nr_migrated
)
149 ctf_integer(unsigned long, nr_failed
, nr_failed
)
152 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
154 #endif /* LTTNG_TRACE_COMPACTION_H */
156 /* This part must be outside protection */
157 #include <probes/define_trace.h>