2 #define TRACE_SYSTEM compaction
4 #if !defined(_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_COMPACTION_H
7 #include <linux/types.h>
8 #include <linux/list.h>
9 #include <linux/tracepoint.h>
10 #include <trace/events/mmflags.h>
13 DECLARE_EVENT_CLASS(mm_compaction_isolate_template
,
16 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 __field(unsigned long, start_pfn
)
25 __field(unsigned long, end_pfn
)
26 __field(unsigned long, nr_scanned
)
27 __field(unsigned long, nr_taken
)
31 __entry
->start_pfn
= start_pfn
;
32 __entry
->end_pfn
= end_pfn
;
33 __entry
->nr_scanned
= nr_scanned
;
34 __entry
->nr_taken
= nr_taken
;
37 TP_printk("range=(0x%lx ~ 0x%lx) nr_scanned=%lu nr_taken=%lu",
44 DEFINE_EVENT(mm_compaction_isolate_template
, mm_compaction_isolate_migratepages
,
47 unsigned long start_pfn
,
48 unsigned long end_pfn
,
49 unsigned long nr_scanned
,
50 unsigned long nr_taken
),
52 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
)
55 DEFINE_EVENT(mm_compaction_isolate_template
, mm_compaction_isolate_freepages
,
58 unsigned long start_pfn
,
59 unsigned long end_pfn
,
60 unsigned long nr_scanned
,
61 unsigned long nr_taken
),
63 TP_ARGS(start_pfn
, end_pfn
, nr_scanned
, nr_taken
)
66 TRACE_EVENT(mm_compaction_migratepages
,
68 TP_PROTO(unsigned long nr_all
,
70 struct list_head
*migratepages
),
72 TP_ARGS(nr_all
, migrate_rc
, migratepages
),
75 __field(unsigned long, nr_migrated
)
76 __field(unsigned long, nr_failed
)
80 unsigned long nr_failed
= 0;
81 struct list_head
*page_lru
;
84 * migrate_pages() returns either a non-negative number
85 * with the number of pages that failed migration, or an
86 * error code, in which case we need to count the remaining
90 nr_failed
= migrate_rc
;
92 list_for_each(page_lru
, migratepages
)
95 __entry
->nr_migrated
= nr_all
- nr_failed
;
96 __entry
->nr_failed
= nr_failed
;
99 TP_printk("nr_migrated=%lu nr_failed=%lu",
100 __entry
->nr_migrated
,
104 TRACE_EVENT(mm_compaction_begin
,
105 TP_PROTO(unsigned long zone_start
, unsigned long migrate_pfn
,
106 unsigned long free_pfn
, unsigned long zone_end
, bool sync
),
108 TP_ARGS(zone_start
, migrate_pfn
, free_pfn
, zone_end
, sync
),
111 __field(unsigned long, zone_start
)
112 __field(unsigned long, migrate_pfn
)
113 __field(unsigned long, free_pfn
)
114 __field(unsigned long, zone_end
)
119 __entry
->zone_start
= zone_start
;
120 __entry
->migrate_pfn
= migrate_pfn
;
121 __entry
->free_pfn
= free_pfn
;
122 __entry
->zone_end
= zone_end
;
123 __entry
->sync
= sync
;
126 TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s",
128 __entry
->migrate_pfn
,
131 __entry
->sync
? "sync" : "async")
134 #ifdef CONFIG_COMPACTION
135 TRACE_EVENT(mm_compaction_end
,
136 TP_PROTO(unsigned long zone_start
, unsigned long migrate_pfn
,
137 unsigned long free_pfn
, unsigned long zone_end
, bool sync
,
140 TP_ARGS(zone_start
, migrate_pfn
, free_pfn
, zone_end
, sync
, status
),
143 __field(unsigned long, zone_start
)
144 __field(unsigned long, migrate_pfn
)
145 __field(unsigned long, free_pfn
)
146 __field(unsigned long, zone_end
)
152 __entry
->zone_start
= zone_start
;
153 __entry
->migrate_pfn
= migrate_pfn
;
154 __entry
->free_pfn
= free_pfn
;
155 __entry
->zone_end
= zone_end
;
156 __entry
->sync
= sync
;
157 __entry
->status
= status
;
160 TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s status=%s",
162 __entry
->migrate_pfn
,
165 __entry
->sync
? "sync" : "async",
166 __print_symbolic(__entry
->status
, COMPACTION_STATUS
))
170 TRACE_EVENT(mm_compaction_try_to_compact_pages
,
177 TP_ARGS(order
, gfp_mask
, prio
),
181 __field(gfp_t
, gfp_mask
)
186 __entry
->order
= order
;
187 __entry
->gfp_mask
= gfp_mask
;
188 __entry
->prio
= prio
;
191 TP_printk("order=%d gfp_mask=0x%x priority=%d",
197 #ifdef CONFIG_COMPACTION
198 DECLARE_EVENT_CLASS(mm_compaction_suitable_template
,
200 TP_PROTO(struct zone
*zone
,
204 TP_ARGS(zone
, order
, ret
),
208 __field(enum zone_type
, idx
)
214 __entry
->nid
= zone_to_nid(zone
);
215 __entry
->idx
= zone_idx(zone
);
216 __entry
->order
= order
;
220 TP_printk("node=%d zone=%-8s order=%d ret=%s",
222 __print_symbolic(__entry
->idx
, ZONE_TYPE
),
224 __print_symbolic(__entry
->ret
, COMPACTION_STATUS
))
227 DEFINE_EVENT(mm_compaction_suitable_template
, mm_compaction_finished
,
229 TP_PROTO(struct zone
*zone
,
233 TP_ARGS(zone
, order
, ret
)
236 DEFINE_EVENT(mm_compaction_suitable_template
, mm_compaction_suitable
,
238 TP_PROTO(struct zone
*zone
,
242 TP_ARGS(zone
, order
, ret
)
245 DECLARE_EVENT_CLASS(mm_compaction_defer_template
,
247 TP_PROTO(struct zone
*zone
, int order
),
249 TP_ARGS(zone
, order
),
253 __field(enum zone_type
, idx
)
255 __field(unsigned int, considered
)
256 __field(unsigned int, defer_shift
)
257 __field(int, order_failed
)
261 __entry
->nid
= zone_to_nid(zone
);
262 __entry
->idx
= zone_idx(zone
);
263 __entry
->order
= order
;
264 __entry
->considered
= zone
->compact_considered
;
265 __entry
->defer_shift
= zone
->compact_defer_shift
;
266 __entry
->order_failed
= zone
->compact_order_failed
;
269 TP_printk("node=%d zone=%-8s order=%d order_failed=%d consider=%u limit=%lu",
271 __print_symbolic(__entry
->idx
, ZONE_TYPE
),
273 __entry
->order_failed
,
275 1UL << __entry
->defer_shift
)
278 DEFINE_EVENT(mm_compaction_defer_template
, mm_compaction_deferred
,
280 TP_PROTO(struct zone
*zone
, int order
),
285 DEFINE_EVENT(mm_compaction_defer_template
, mm_compaction_defer_compaction
,
287 TP_PROTO(struct zone
*zone
, int order
),
292 DEFINE_EVENT(mm_compaction_defer_template
, mm_compaction_defer_reset
,
294 TP_PROTO(struct zone
*zone
, int order
),
300 TRACE_EVENT(mm_compaction_kcompactd_sleep
,
314 TP_printk("nid=%d", __entry
->nid
)
317 DECLARE_EVENT_CLASS(kcompactd_wake_template
,
319 TP_PROTO(int nid
, int order
, enum zone_type classzone_idx
),
321 TP_ARGS(nid
, order
, classzone_idx
),
326 __field(enum zone_type
, classzone_idx
)
331 __entry
->order
= order
;
332 __entry
->classzone_idx
= classzone_idx
;
335 TP_printk("nid=%d order=%d classzone_idx=%-8s",
338 __print_symbolic(__entry
->classzone_idx
, ZONE_TYPE
))
341 DEFINE_EVENT(kcompactd_wake_template
, mm_compaction_wakeup_kcompactd
,
343 TP_PROTO(int nid
, int order
, enum zone_type classzone_idx
),
345 TP_ARGS(nid
, order
, classzone_idx
)
348 DEFINE_EVENT(kcompactd_wake_template
, mm_compaction_kcompactd_wake
,
350 TP_PROTO(int nid
, int order
, enum zone_type classzone_idx
),
352 TP_ARGS(nid
, order
, classzone_idx
)
355 #endif /* _TRACE_COMPACTION_H */
357 /* This part must be outside protection */
358 #include <trace/define_trace.h>