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/gfpflags.h>
12 DECLARE_EVENT_CLASS(mm_compaction_isolate_template
,
14 TP_PROTO(unsigned long nr_scanned
,
15 unsigned long nr_taken
),
17 TP_ARGS(nr_scanned
, nr_taken
),
20 __field(unsigned long, nr_scanned
)
21 __field(unsigned long, nr_taken
)
25 __entry
->nr_scanned
= nr_scanned
;
26 __entry
->nr_taken
= nr_taken
;
29 TP_printk("nr_scanned=%lu nr_taken=%lu",
34 DEFINE_EVENT(mm_compaction_isolate_template
, mm_compaction_isolate_migratepages
,
36 TP_PROTO(unsigned long nr_scanned
,
37 unsigned long nr_taken
),
39 TP_ARGS(nr_scanned
, nr_taken
)
42 DEFINE_EVENT(mm_compaction_isolate_template
, mm_compaction_isolate_freepages
,
43 TP_PROTO(unsigned long nr_scanned
,
44 unsigned long nr_taken
),
46 TP_ARGS(nr_scanned
, nr_taken
)
49 TRACE_EVENT(mm_compaction_migratepages
,
51 TP_PROTO(unsigned long nr_all
,
53 struct list_head
*migratepages
),
55 TP_ARGS(nr_all
, migrate_rc
, migratepages
),
58 __field(unsigned long, nr_migrated
)
59 __field(unsigned long, nr_failed
)
63 unsigned long nr_failed
= 0;
64 struct list_head
*page_lru
;
67 * migrate_pages() returns either a non-negative number
68 * with the number of pages that failed migration, or an
69 * error code, in which case we need to count the remaining
73 nr_failed
= migrate_rc
;
75 list_for_each(page_lru
, migratepages
)
78 __entry
->nr_migrated
= nr_all
- nr_failed
;
79 __entry
->nr_failed
= nr_failed
;
82 TP_printk("nr_migrated=%lu nr_failed=%lu",
87 TRACE_EVENT(mm_compaction_begin
,
88 TP_PROTO(unsigned long zone_start
, unsigned long migrate_start
,
89 unsigned long free_start
, unsigned long zone_end
),
91 TP_ARGS(zone_start
, migrate_start
, free_start
, zone_end
),
94 __field(unsigned long, zone_start
)
95 __field(unsigned long, migrate_start
)
96 __field(unsigned long, free_start
)
97 __field(unsigned long, zone_end
)
101 __entry
->zone_start
= zone_start
;
102 __entry
->migrate_start
= migrate_start
;
103 __entry
->free_start
= free_start
;
104 __entry
->zone_end
= zone_end
;
107 TP_printk("zone_start=%lu migrate_start=%lu free_start=%lu zone_end=%lu",
109 __entry
->migrate_start
,
114 TRACE_EVENT(mm_compaction_end
,
115 TP_PROTO(int status
),
124 __entry
->status
= status
;
127 TP_printk("status=%d", __entry
->status
)
130 #endif /* _TRACE_COMPACTION_H */
132 /* This part must be outside protection */
133 #include <trace/define_trace.h>