blob: 839f6fac921a4016b3a3866f081fd0cc6a605dd2 [file] [log] [blame]
Mel Gormanb7aba692011-01-13 15:45:54 -08001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM compaction
3
4#if !defined(_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_COMPACTION_H
6
7#include <linux/types.h>
Vlastimil Babkaf8c93012014-06-04 16:08:32 -07008#include <linux/list.h>
Mel Gormanb7aba692011-01-13 15:45:54 -08009#include <linux/tracepoint.h>
David Howellsa1ce3922012-10-02 18:01:25 +010010#include <trace/events/gfpflags.h>
Mel Gormanb7aba692011-01-13 15:45:54 -080011
12DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
13
14 TP_PROTO(unsigned long nr_scanned,
15 unsigned long nr_taken),
16
17 TP_ARGS(nr_scanned, nr_taken),
18
19 TP_STRUCT__entry(
20 __field(unsigned long, nr_scanned)
21 __field(unsigned long, nr_taken)
22 ),
23
24 TP_fast_assign(
25 __entry->nr_scanned = nr_scanned;
26 __entry->nr_taken = nr_taken;
27 ),
28
29 TP_printk("nr_scanned=%lu nr_taken=%lu",
30 __entry->nr_scanned,
31 __entry->nr_taken)
32);
33
34DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_migratepages,
35
36 TP_PROTO(unsigned long nr_scanned,
37 unsigned long nr_taken),
38
39 TP_ARGS(nr_scanned, nr_taken)
40);
41
42DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages,
43 TP_PROTO(unsigned long nr_scanned,
44 unsigned long nr_taken),
45
46 TP_ARGS(nr_scanned, nr_taken)
47);
48
49TRACE_EVENT(mm_compaction_migratepages,
50
Vlastimil Babkaf8c93012014-06-04 16:08:32 -070051 TP_PROTO(unsigned long nr_all,
52 int migrate_rc,
53 struct list_head *migratepages),
Mel Gormanb7aba692011-01-13 15:45:54 -080054
Vlastimil Babkaf8c93012014-06-04 16:08:32 -070055 TP_ARGS(nr_all, migrate_rc, migratepages),
Mel Gormanb7aba692011-01-13 15:45:54 -080056
57 TP_STRUCT__entry(
58 __field(unsigned long, nr_migrated)
59 __field(unsigned long, nr_failed)
60 ),
61
62 TP_fast_assign(
Vlastimil Babkaf8c93012014-06-04 16:08:32 -070063 unsigned long nr_failed = 0;
64 struct list_head *page_lru;
65
66 /*
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
70 * pages manually
71 */
72 if (migrate_rc >= 0)
73 nr_failed = migrate_rc;
74 else
75 list_for_each(page_lru, migratepages)
76 nr_failed++;
77
78 __entry->nr_migrated = nr_all - nr_failed;
Mel Gormanb7aba692011-01-13 15:45:54 -080079 __entry->nr_failed = nr_failed;
80 ),
81
82 TP_printk("nr_migrated=%lu nr_failed=%lu",
83 __entry->nr_migrated,
84 __entry->nr_failed)
85);
86
Mel Gorman0eb927c2014-01-21 15:51:05 -080087TRACE_EVENT(mm_compaction_begin,
Joonsoo Kim16c4a092015-02-11 15:27:01 -080088 TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn,
89 unsigned long free_pfn, unsigned long zone_end, bool sync),
Mel Gorman0eb927c2014-01-21 15:51:05 -080090
Joonsoo Kim16c4a092015-02-11 15:27:01 -080091 TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync),
Mel Gorman0eb927c2014-01-21 15:51:05 -080092
93 TP_STRUCT__entry(
94 __field(unsigned long, zone_start)
Joonsoo Kim16c4a092015-02-11 15:27:01 -080095 __field(unsigned long, migrate_pfn)
96 __field(unsigned long, free_pfn)
Mel Gorman0eb927c2014-01-21 15:51:05 -080097 __field(unsigned long, zone_end)
Joonsoo Kim16c4a092015-02-11 15:27:01 -080098 __field(bool, sync)
Mel Gorman0eb927c2014-01-21 15:51:05 -080099 ),
100
101 TP_fast_assign(
102 __entry->zone_start = zone_start;
Joonsoo Kim16c4a092015-02-11 15:27:01 -0800103 __entry->migrate_pfn = migrate_pfn;
104 __entry->free_pfn = free_pfn;
Mel Gorman0eb927c2014-01-21 15:51:05 -0800105 __entry->zone_end = zone_end;
Joonsoo Kim16c4a092015-02-11 15:27:01 -0800106 __entry->sync = sync;
Mel Gorman0eb927c2014-01-21 15:51:05 -0800107 ),
108
Joonsoo Kim16c4a092015-02-11 15:27:01 -0800109 TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s",
Mel Gorman0eb927c2014-01-21 15:51:05 -0800110 __entry->zone_start,
Joonsoo Kim16c4a092015-02-11 15:27:01 -0800111 __entry->migrate_pfn,
112 __entry->free_pfn,
113 __entry->zone_end,
114 __entry->sync ? "sync" : "async")
Mel Gorman0eb927c2014-01-21 15:51:05 -0800115);
116
117TRACE_EVENT(mm_compaction_end,
Joonsoo Kim16c4a092015-02-11 15:27:01 -0800118 TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn,
119 unsigned long free_pfn, unsigned long zone_end, bool sync,
120 int status),
Mel Gorman0eb927c2014-01-21 15:51:05 -0800121
Joonsoo Kim16c4a092015-02-11 15:27:01 -0800122 TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync, status),
Mel Gorman0eb927c2014-01-21 15:51:05 -0800123
124 TP_STRUCT__entry(
Joonsoo Kim16c4a092015-02-11 15:27:01 -0800125 __field(unsigned long, zone_start)
126 __field(unsigned long, migrate_pfn)
127 __field(unsigned long, free_pfn)
128 __field(unsigned long, zone_end)
129 __field(bool, sync)
Mel Gorman0eb927c2014-01-21 15:51:05 -0800130 __field(int, status)
131 ),
132
133 TP_fast_assign(
Joonsoo Kim16c4a092015-02-11 15:27:01 -0800134 __entry->zone_start = zone_start;
135 __entry->migrate_pfn = migrate_pfn;
136 __entry->free_pfn = free_pfn;
137 __entry->zone_end = zone_end;
138 __entry->sync = sync;
Mel Gorman0eb927c2014-01-21 15:51:05 -0800139 __entry->status = status;
140 ),
141
Joonsoo Kim16c4a092015-02-11 15:27:01 -0800142 TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s status=%s",
143 __entry->zone_start,
144 __entry->migrate_pfn,
145 __entry->free_pfn,
146 __entry->zone_end,
147 __entry->sync ? "sync" : "async",
148 compaction_status_string[__entry->status])
Mel Gorman0eb927c2014-01-21 15:51:05 -0800149);
Mel Gormanb7aba692011-01-13 15:45:54 -0800150
151#endif /* _TRACE_COMPACTION_H */
152
153/* This part must be outside protection */
154#include <trace/define_trace.h>