Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / include / trace / events / compaction.h
blob0a18ab6483ffefb6e650a5fa8a95fd77ea4808df
1 #undef TRACE_SYSTEM
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,
15 TP_PROTO(
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),
23 TP_STRUCT__entry(
24 __field(unsigned long, start_pfn)
25 __field(unsigned long, end_pfn)
26 __field(unsigned long, nr_scanned)
27 __field(unsigned long, nr_taken)
30 TP_fast_assign(
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",
38 __entry->start_pfn,
39 __entry->end_pfn,
40 __entry->nr_scanned,
41 __entry->nr_taken)
44 DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_migratepages,
46 TP_PROTO(
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,
57 TP_PROTO(
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,
69 int migrate_rc,
70 struct list_head *migratepages),
72 TP_ARGS(nr_all, migrate_rc, migratepages),
74 TP_STRUCT__entry(
75 __field(unsigned long, nr_migrated)
76 __field(unsigned long, nr_failed)
79 TP_fast_assign(
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
87 * pages manually
89 if (migrate_rc >= 0)
90 nr_failed = migrate_rc;
91 else
92 list_for_each(page_lru, migratepages)
93 nr_failed++;
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,
101 __entry->nr_failed)
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),
110 TP_STRUCT__entry(
111 __field(unsigned long, zone_start)
112 __field(unsigned long, migrate_pfn)
113 __field(unsigned long, free_pfn)
114 __field(unsigned long, zone_end)
115 __field(bool, sync)
118 TP_fast_assign(
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",
127 __entry->zone_start,
128 __entry->migrate_pfn,
129 __entry->free_pfn,
130 __entry->zone_end,
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,
138 int status),
140 TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync, status),
142 TP_STRUCT__entry(
143 __field(unsigned long, zone_start)
144 __field(unsigned long, migrate_pfn)
145 __field(unsigned long, free_pfn)
146 __field(unsigned long, zone_end)
147 __field(bool, sync)
148 __field(int, status)
151 TP_fast_assign(
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",
161 __entry->zone_start,
162 __entry->migrate_pfn,
163 __entry->free_pfn,
164 __entry->zone_end,
165 __entry->sync ? "sync" : "async",
166 __print_symbolic(__entry->status, COMPACTION_STATUS))
168 #endif
170 TRACE_EVENT(mm_compaction_try_to_compact_pages,
172 TP_PROTO(
173 int order,
174 gfp_t gfp_mask,
175 int prio),
177 TP_ARGS(order, gfp_mask, prio),
179 TP_STRUCT__entry(
180 __field(int, order)
181 __field(gfp_t, gfp_mask)
182 __field(int, prio)
185 TP_fast_assign(
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",
192 __entry->order,
193 __entry->gfp_mask,
194 __entry->prio)
197 #ifdef CONFIG_COMPACTION
198 DECLARE_EVENT_CLASS(mm_compaction_suitable_template,
200 TP_PROTO(struct zone *zone,
201 int order,
202 int ret),
204 TP_ARGS(zone, order, ret),
206 TP_STRUCT__entry(
207 __field(int, nid)
208 __field(enum zone_type, idx)
209 __field(int, order)
210 __field(int, ret)
213 TP_fast_assign(
214 __entry->nid = zone_to_nid(zone);
215 __entry->idx = zone_idx(zone);
216 __entry->order = order;
217 __entry->ret = ret;
220 TP_printk("node=%d zone=%-8s order=%d ret=%s",
221 __entry->nid,
222 __print_symbolic(__entry->idx, ZONE_TYPE),
223 __entry->order,
224 __print_symbolic(__entry->ret, COMPACTION_STATUS))
227 DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_finished,
229 TP_PROTO(struct zone *zone,
230 int order,
231 int ret),
233 TP_ARGS(zone, order, ret)
236 DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_suitable,
238 TP_PROTO(struct zone *zone,
239 int order,
240 int ret),
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),
251 TP_STRUCT__entry(
252 __field(int, nid)
253 __field(enum zone_type, idx)
254 __field(int, order)
255 __field(unsigned int, considered)
256 __field(unsigned int, defer_shift)
257 __field(int, order_failed)
260 TP_fast_assign(
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",
270 __entry->nid,
271 __print_symbolic(__entry->idx, ZONE_TYPE),
272 __entry->order,
273 __entry->order_failed,
274 __entry->considered,
275 1UL << __entry->defer_shift)
278 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_deferred,
280 TP_PROTO(struct zone *zone, int order),
282 TP_ARGS(zone, order)
285 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_compaction,
287 TP_PROTO(struct zone *zone, int order),
289 TP_ARGS(zone, order)
292 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_reset,
294 TP_PROTO(struct zone *zone, int order),
296 TP_ARGS(zone, order)
298 #endif
300 TRACE_EVENT(mm_compaction_kcompactd_sleep,
302 TP_PROTO(int nid),
304 TP_ARGS(nid),
306 TP_STRUCT__entry(
307 __field(int, nid)
310 TP_fast_assign(
311 __entry->nid = nid;
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),
323 TP_STRUCT__entry(
324 __field(int, nid)
325 __field(int, order)
326 __field(enum zone_type, classzone_idx)
329 TP_fast_assign(
330 __entry->nid = nid;
331 __entry->order = order;
332 __entry->classzone_idx = classzone_idx;
335 TP_printk("nid=%d order=%d classzone_idx=%-8s",
336 __entry->nid,
337 __entry->order,
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>