unify {de,}mangle_poll(), get rid of kernel-side POLL...
[cris-mirror.git] / include / trace / events / vmscan.h
blobe0b8b9173e1c1a5fe5a40a0f52aeb4b0ea593771
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM vmscan
5 #if !defined(_TRACE_VMSCAN_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_VMSCAN_H
8 #include <linux/types.h>
9 #include <linux/tracepoint.h>
10 #include <linux/mm.h>
11 #include <linux/memcontrol.h>
12 #include <trace/events/mmflags.h>
14 #define RECLAIM_WB_ANON 0x0001u
15 #define RECLAIM_WB_FILE 0x0002u
16 #define RECLAIM_WB_MIXED 0x0010u
17 #define RECLAIM_WB_SYNC 0x0004u /* Unused, all reclaim async */
18 #define RECLAIM_WB_ASYNC 0x0008u
19 #define RECLAIM_WB_LRU (RECLAIM_WB_ANON|RECLAIM_WB_FILE)
21 #define show_reclaim_flags(flags) \
22 (flags) ? __print_flags(flags, "|", \
23 {RECLAIM_WB_ANON, "RECLAIM_WB_ANON"}, \
24 {RECLAIM_WB_FILE, "RECLAIM_WB_FILE"}, \
25 {RECLAIM_WB_MIXED, "RECLAIM_WB_MIXED"}, \
26 {RECLAIM_WB_SYNC, "RECLAIM_WB_SYNC"}, \
27 {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \
28 ) : "RECLAIM_WB_NONE"
30 #define trace_reclaim_flags(page) ( \
31 (page_is_file_cache(page) ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
32 (RECLAIM_WB_ASYNC) \
35 #define trace_shrink_flags(file) \
36 ( \
37 (file ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
38 (RECLAIM_WB_ASYNC) \
41 TRACE_EVENT(mm_vmscan_kswapd_sleep,
43 TP_PROTO(int nid),
45 TP_ARGS(nid),
47 TP_STRUCT__entry(
48 __field( int, nid )
51 TP_fast_assign(
52 __entry->nid = nid;
55 TP_printk("nid=%d", __entry->nid)
58 TRACE_EVENT(mm_vmscan_kswapd_wake,
60 TP_PROTO(int nid, int zid, int order),
62 TP_ARGS(nid, zid, order),
64 TP_STRUCT__entry(
65 __field( int, nid )
66 __field( int, zid )
67 __field( int, order )
70 TP_fast_assign(
71 __entry->nid = nid;
72 __entry->zid = zid;
73 __entry->order = order;
76 TP_printk("nid=%d zid=%d order=%d", __entry->nid, __entry->zid, __entry->order)
79 TRACE_EVENT(mm_vmscan_wakeup_kswapd,
81 TP_PROTO(int nid, int zid, int order),
83 TP_ARGS(nid, zid, order),
85 TP_STRUCT__entry(
86 __field( int, nid )
87 __field( int, zid )
88 __field( int, order )
91 TP_fast_assign(
92 __entry->nid = nid;
93 __entry->zid = zid;
94 __entry->order = order;
97 TP_printk("nid=%d zid=%d order=%d",
98 __entry->nid,
99 __entry->zid,
100 __entry->order)
103 DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template,
105 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx),
107 TP_ARGS(order, may_writepage, gfp_flags, classzone_idx),
109 TP_STRUCT__entry(
110 __field( int, order )
111 __field( int, may_writepage )
112 __field( gfp_t, gfp_flags )
113 __field( int, classzone_idx )
116 TP_fast_assign(
117 __entry->order = order;
118 __entry->may_writepage = may_writepage;
119 __entry->gfp_flags = gfp_flags;
120 __entry->classzone_idx = classzone_idx;
123 TP_printk("order=%d may_writepage=%d gfp_flags=%s classzone_idx=%d",
124 __entry->order,
125 __entry->may_writepage,
126 show_gfp_flags(__entry->gfp_flags),
127 __entry->classzone_idx)
130 DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin,
132 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx),
134 TP_ARGS(order, may_writepage, gfp_flags, classzone_idx)
137 #ifdef CONFIG_MEMCG
138 DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin,
140 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx),
142 TP_ARGS(order, may_writepage, gfp_flags, classzone_idx)
145 DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin,
147 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx),
149 TP_ARGS(order, may_writepage, gfp_flags, classzone_idx)
151 #endif /* CONFIG_MEMCG */
153 DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template,
155 TP_PROTO(unsigned long nr_reclaimed),
157 TP_ARGS(nr_reclaimed),
159 TP_STRUCT__entry(
160 __field( unsigned long, nr_reclaimed )
163 TP_fast_assign(
164 __entry->nr_reclaimed = nr_reclaimed;
167 TP_printk("nr_reclaimed=%lu", __entry->nr_reclaimed)
170 DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end,
172 TP_PROTO(unsigned long nr_reclaimed),
174 TP_ARGS(nr_reclaimed)
177 #ifdef CONFIG_MEMCG
178 DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end,
180 TP_PROTO(unsigned long nr_reclaimed),
182 TP_ARGS(nr_reclaimed)
185 DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reclaim_end,
187 TP_PROTO(unsigned long nr_reclaimed),
189 TP_ARGS(nr_reclaimed)
191 #endif /* CONFIG_MEMCG */
193 TRACE_EVENT(mm_shrink_slab_start,
194 TP_PROTO(struct shrinker *shr, struct shrink_control *sc,
195 long nr_objects_to_shrink, unsigned long cache_items,
196 unsigned long long delta, unsigned long total_scan,
197 int priority),
199 TP_ARGS(shr, sc, nr_objects_to_shrink, cache_items, delta, total_scan,
200 priority),
202 TP_STRUCT__entry(
203 __field(struct shrinker *, shr)
204 __field(void *, shrink)
205 __field(int, nid)
206 __field(long, nr_objects_to_shrink)
207 __field(gfp_t, gfp_flags)
208 __field(unsigned long, cache_items)
209 __field(unsigned long long, delta)
210 __field(unsigned long, total_scan)
211 __field(int, priority)
214 TP_fast_assign(
215 __entry->shr = shr;
216 __entry->shrink = shr->scan_objects;
217 __entry->nid = sc->nid;
218 __entry->nr_objects_to_shrink = nr_objects_to_shrink;
219 __entry->gfp_flags = sc->gfp_mask;
220 __entry->cache_items = cache_items;
221 __entry->delta = delta;
222 __entry->total_scan = total_scan;
223 __entry->priority = priority;
226 TP_printk("%pF %p: nid: %d objects to shrink %ld gfp_flags %s cache items %ld delta %lld total_scan %ld priority %d",
227 __entry->shrink,
228 __entry->shr,
229 __entry->nid,
230 __entry->nr_objects_to_shrink,
231 show_gfp_flags(__entry->gfp_flags),
232 __entry->cache_items,
233 __entry->delta,
234 __entry->total_scan,
235 __entry->priority)
238 TRACE_EVENT(mm_shrink_slab_end,
239 TP_PROTO(struct shrinker *shr, int nid, int shrinker_retval,
240 long unused_scan_cnt, long new_scan_cnt, long total_scan),
242 TP_ARGS(shr, nid, shrinker_retval, unused_scan_cnt, new_scan_cnt,
243 total_scan),
245 TP_STRUCT__entry(
246 __field(struct shrinker *, shr)
247 __field(int, nid)
248 __field(void *, shrink)
249 __field(long, unused_scan)
250 __field(long, new_scan)
251 __field(int, retval)
252 __field(long, total_scan)
255 TP_fast_assign(
256 __entry->shr = shr;
257 __entry->nid = nid;
258 __entry->shrink = shr->scan_objects;
259 __entry->unused_scan = unused_scan_cnt;
260 __entry->new_scan = new_scan_cnt;
261 __entry->retval = shrinker_retval;
262 __entry->total_scan = total_scan;
265 TP_printk("%pF %p: nid: %d unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d",
266 __entry->shrink,
267 __entry->shr,
268 __entry->nid,
269 __entry->unused_scan,
270 __entry->new_scan,
271 __entry->total_scan,
272 __entry->retval)
275 TRACE_EVENT(mm_vmscan_lru_isolate,
276 TP_PROTO(int classzone_idx,
277 int order,
278 unsigned long nr_requested,
279 unsigned long nr_scanned,
280 unsigned long nr_skipped,
281 unsigned long nr_taken,
282 isolate_mode_t isolate_mode,
283 int lru),
285 TP_ARGS(classzone_idx, order, nr_requested, nr_scanned, nr_skipped, nr_taken, isolate_mode, lru),
287 TP_STRUCT__entry(
288 __field(int, classzone_idx)
289 __field(int, order)
290 __field(unsigned long, nr_requested)
291 __field(unsigned long, nr_scanned)
292 __field(unsigned long, nr_skipped)
293 __field(unsigned long, nr_taken)
294 __field(isolate_mode_t, isolate_mode)
295 __field(int, lru)
298 TP_fast_assign(
299 __entry->classzone_idx = classzone_idx;
300 __entry->order = order;
301 __entry->nr_requested = nr_requested;
302 __entry->nr_scanned = nr_scanned;
303 __entry->nr_skipped = nr_skipped;
304 __entry->nr_taken = nr_taken;
305 __entry->isolate_mode = isolate_mode;
306 __entry->lru = lru;
309 TP_printk("isolate_mode=%d classzone=%d order=%d nr_requested=%lu nr_scanned=%lu nr_skipped=%lu nr_taken=%lu lru=%s",
310 __entry->isolate_mode,
311 __entry->classzone_idx,
312 __entry->order,
313 __entry->nr_requested,
314 __entry->nr_scanned,
315 __entry->nr_skipped,
316 __entry->nr_taken,
317 __print_symbolic(__entry->lru, LRU_NAMES))
320 TRACE_EVENT(mm_vmscan_writepage,
322 TP_PROTO(struct page *page),
324 TP_ARGS(page),
326 TP_STRUCT__entry(
327 __field(unsigned long, pfn)
328 __field(int, reclaim_flags)
331 TP_fast_assign(
332 __entry->pfn = page_to_pfn(page);
333 __entry->reclaim_flags = trace_reclaim_flags(page);
336 TP_printk("page=%p pfn=%lu flags=%s",
337 pfn_to_page(__entry->pfn),
338 __entry->pfn,
339 show_reclaim_flags(__entry->reclaim_flags))
342 TRACE_EVENT(mm_vmscan_lru_shrink_inactive,
344 TP_PROTO(int nid,
345 unsigned long nr_scanned, unsigned long nr_reclaimed,
346 unsigned long nr_dirty, unsigned long nr_writeback,
347 unsigned long nr_congested, unsigned long nr_immediate,
348 unsigned long nr_activate, unsigned long nr_ref_keep,
349 unsigned long nr_unmap_fail,
350 int priority, int file),
352 TP_ARGS(nid, nr_scanned, nr_reclaimed, nr_dirty, nr_writeback,
353 nr_congested, nr_immediate, nr_activate, nr_ref_keep,
354 nr_unmap_fail, priority, file),
356 TP_STRUCT__entry(
357 __field(int, nid)
358 __field(unsigned long, nr_scanned)
359 __field(unsigned long, nr_reclaimed)
360 __field(unsigned long, nr_dirty)
361 __field(unsigned long, nr_writeback)
362 __field(unsigned long, nr_congested)
363 __field(unsigned long, nr_immediate)
364 __field(unsigned long, nr_activate)
365 __field(unsigned long, nr_ref_keep)
366 __field(unsigned long, nr_unmap_fail)
367 __field(int, priority)
368 __field(int, reclaim_flags)
371 TP_fast_assign(
372 __entry->nid = nid;
373 __entry->nr_scanned = nr_scanned;
374 __entry->nr_reclaimed = nr_reclaimed;
375 __entry->nr_dirty = nr_dirty;
376 __entry->nr_writeback = nr_writeback;
377 __entry->nr_congested = nr_congested;
378 __entry->nr_immediate = nr_immediate;
379 __entry->nr_activate = nr_activate;
380 __entry->nr_ref_keep = nr_ref_keep;
381 __entry->nr_unmap_fail = nr_unmap_fail;
382 __entry->priority = priority;
383 __entry->reclaim_flags = trace_shrink_flags(file);
386 TP_printk("nid=%d nr_scanned=%ld nr_reclaimed=%ld nr_dirty=%ld nr_writeback=%ld nr_congested=%ld nr_immediate=%ld nr_activate=%ld nr_ref_keep=%ld nr_unmap_fail=%ld priority=%d flags=%s",
387 __entry->nid,
388 __entry->nr_scanned, __entry->nr_reclaimed,
389 __entry->nr_dirty, __entry->nr_writeback,
390 __entry->nr_congested, __entry->nr_immediate,
391 __entry->nr_activate, __entry->nr_ref_keep,
392 __entry->nr_unmap_fail, __entry->priority,
393 show_reclaim_flags(__entry->reclaim_flags))
396 TRACE_EVENT(mm_vmscan_lru_shrink_active,
398 TP_PROTO(int nid, unsigned long nr_taken,
399 unsigned long nr_active, unsigned long nr_deactivated,
400 unsigned long nr_referenced, int priority, int file),
402 TP_ARGS(nid, nr_taken, nr_active, nr_deactivated, nr_referenced, priority, file),
404 TP_STRUCT__entry(
405 __field(int, nid)
406 __field(unsigned long, nr_taken)
407 __field(unsigned long, nr_active)
408 __field(unsigned long, nr_deactivated)
409 __field(unsigned long, nr_referenced)
410 __field(int, priority)
411 __field(int, reclaim_flags)
414 TP_fast_assign(
415 __entry->nid = nid;
416 __entry->nr_taken = nr_taken;
417 __entry->nr_active = nr_active;
418 __entry->nr_deactivated = nr_deactivated;
419 __entry->nr_referenced = nr_referenced;
420 __entry->priority = priority;
421 __entry->reclaim_flags = trace_shrink_flags(file);
424 TP_printk("nid=%d nr_taken=%ld nr_active=%ld nr_deactivated=%ld nr_referenced=%ld priority=%d flags=%s",
425 __entry->nid,
426 __entry->nr_taken,
427 __entry->nr_active, __entry->nr_deactivated, __entry->nr_referenced,
428 __entry->priority,
429 show_reclaim_flags(__entry->reclaim_flags))
432 TRACE_EVENT(mm_vmscan_inactive_list_is_low,
434 TP_PROTO(int nid, int reclaim_idx,
435 unsigned long total_inactive, unsigned long inactive,
436 unsigned long total_active, unsigned long active,
437 unsigned long ratio, int file),
439 TP_ARGS(nid, reclaim_idx, total_inactive, inactive, total_active, active, ratio, file),
441 TP_STRUCT__entry(
442 __field(int, nid)
443 __field(int, reclaim_idx)
444 __field(unsigned long, total_inactive)
445 __field(unsigned long, inactive)
446 __field(unsigned long, total_active)
447 __field(unsigned long, active)
448 __field(unsigned long, ratio)
449 __field(int, reclaim_flags)
452 TP_fast_assign(
453 __entry->nid = nid;
454 __entry->reclaim_idx = reclaim_idx;
455 __entry->total_inactive = total_inactive;
456 __entry->inactive = inactive;
457 __entry->total_active = total_active;
458 __entry->active = active;
459 __entry->ratio = ratio;
460 __entry->reclaim_flags = trace_shrink_flags(file) & RECLAIM_WB_LRU;
463 TP_printk("nid=%d reclaim_idx=%d total_inactive=%ld inactive=%ld total_active=%ld active=%ld ratio=%ld flags=%s",
464 __entry->nid,
465 __entry->reclaim_idx,
466 __entry->total_inactive, __entry->inactive,
467 __entry->total_active, __entry->active,
468 __entry->ratio,
469 show_reclaim_flags(__entry->reclaim_flags))
471 #endif /* _TRACE_VMSCAN_H */
473 /* This part must be outside protection */
474 #include <trace/define_trace.h>