]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - include/trace/events/vmscan.h
Merge tag 'imx-fixes-5.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/shawngu...
[mirror_ubuntu-jammy-kernel.git] / include / trace / events / vmscan.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
33906bc5
MG
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM vmscan
4
5#if !defined(_TRACE_VMSCAN_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_VMSCAN_H
7
8#include <linux/types.h>
9#include <linux/tracepoint.h>
83cd81a3
KM
10#include <linux/mm.h>
11#include <linux/memcontrol.h>
420adbe9 12#include <trace/events/mmflags.h>
33906bc5 13
755f0225
MG
14#define RECLAIM_WB_ANON 0x0001u
15#define RECLAIM_WB_FILE 0x0002u
e11da5b4 16#define RECLAIM_WB_MIXED 0x0010u
41ac1999 17#define RECLAIM_WB_SYNC 0x0004u /* Unused, all reclaim async */
755f0225 18#define RECLAIM_WB_ASYNC 0x0008u
dcec0b60 19#define RECLAIM_WB_LRU (RECLAIM_WB_ANON|RECLAIM_WB_FILE)
755f0225
MG
20
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"}, \
e11da5b4 25 {RECLAIM_WB_MIXED, "RECLAIM_WB_MIXED"}, \
755f0225
MG
26 {RECLAIM_WB_SYNC, "RECLAIM_WB_SYNC"}, \
27 {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \
28 ) : "RECLAIM_WB_NONE"
29
60b62ff7
YS
30#define trace_reclaim_flags(file) ( \
31 (file ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
41ac1999 32 (RECLAIM_WB_ASYNC) \
755f0225
MG
33 )
34
33906bc5
MG
35TRACE_EVENT(mm_vmscan_kswapd_sleep,
36
37 TP_PROTO(int nid),
38
39 TP_ARGS(nid),
40
41 TP_STRUCT__entry(
42 __field( int, nid )
43 ),
44
45 TP_fast_assign(
46 __entry->nid = nid;
47 ),
48
49 TP_printk("nid=%d", __entry->nid)
50);
51
52TRACE_EVENT(mm_vmscan_kswapd_wake,
53
e5146b12 54 TP_PROTO(int nid, int zid, int order),
33906bc5 55
e5146b12 56 TP_ARGS(nid, zid, order),
33906bc5
MG
57
58 TP_STRUCT__entry(
59 __field( int, nid )
e5146b12 60 __field( int, zid )
33906bc5
MG
61 __field( int, order )
62 ),
63
64 TP_fast_assign(
65 __entry->nid = nid;
e5146b12 66 __entry->zid = zid;
33906bc5
MG
67 __entry->order = order;
68 ),
69
3b775998
YS
70 TP_printk("nid=%d order=%d",
71 __entry->nid,
72 __entry->order)
33906bc5
MG
73);
74
75TRACE_EVENT(mm_vmscan_wakeup_kswapd,
76
5ecd9d40 77 TP_PROTO(int nid, int zid, int order, gfp_t gfp_flags),
33906bc5 78
5ecd9d40 79 TP_ARGS(nid, zid, order, gfp_flags),
33906bc5
MG
80
81 TP_STRUCT__entry(
5ecd9d40
DR
82 __field( int, nid )
83 __field( int, zid )
84 __field( int, order )
85 __field( gfp_t, gfp_flags )
33906bc5
MG
86 ),
87
88 TP_fast_assign(
89 __entry->nid = nid;
90 __entry->zid = zid;
91 __entry->order = order;
5ecd9d40 92 __entry->gfp_flags = gfp_flags;
33906bc5
MG
93 ),
94
3b775998 95 TP_printk("nid=%d order=%d gfp_flags=%s",
33906bc5 96 __entry->nid,
5ecd9d40
DR
97 __entry->order,
98 show_gfp_flags(__entry->gfp_flags))
33906bc5
MG
99);
100
cf4dcc3e 101DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template,
33906bc5 102
3481c37f 103 TP_PROTO(int order, gfp_t gfp_flags),
33906bc5 104
3481c37f 105 TP_ARGS(order, gfp_flags),
33906bc5
MG
106
107 TP_STRUCT__entry(
108 __field( int, order )
33906bc5
MG
109 __field( gfp_t, gfp_flags )
110 ),
111
112 TP_fast_assign(
113 __entry->order = order;
33906bc5
MG
114 __entry->gfp_flags = gfp_flags;
115 ),
116
3481c37f 117 TP_printk("order=%d gfp_flags=%s",
33906bc5 118 __entry->order,
3481c37f 119 show_gfp_flags(__entry->gfp_flags))
33906bc5
MG
120);
121
cf4dcc3e
KM
122DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin,
123
3481c37f 124 TP_PROTO(int order, gfp_t gfp_flags),
cf4dcc3e 125
3481c37f 126 TP_ARGS(order, gfp_flags)
cf4dcc3e
KM
127);
128
f40a37cb 129#ifdef CONFIG_MEMCG
bdce6d9e
KM
130DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin,
131
3481c37f 132 TP_PROTO(int order, gfp_t gfp_flags),
bdce6d9e 133
3481c37f 134 TP_ARGS(order, gfp_flags)
bdce6d9e
KM
135);
136
137DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin,
138
3481c37f 139 TP_PROTO(int order, gfp_t gfp_flags),
bdce6d9e 140
3481c37f 141 TP_ARGS(order, gfp_flags)
bdce6d9e 142);
f40a37cb 143#endif /* CONFIG_MEMCG */
cf4dcc3e
KM
144
145DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template,
33906bc5
MG
146
147 TP_PROTO(unsigned long nr_reclaimed),
148
149 TP_ARGS(nr_reclaimed),
150
151 TP_STRUCT__entry(
152 __field( unsigned long, nr_reclaimed )
153 ),
154
155 TP_fast_assign(
156 __entry->nr_reclaimed = nr_reclaimed;
157 ),
158
159 TP_printk("nr_reclaimed=%lu", __entry->nr_reclaimed)
160);
161
cf4dcc3e
KM
162DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end,
163
164 TP_PROTO(unsigned long nr_reclaimed),
165
166 TP_ARGS(nr_reclaimed)
167);
168
f40a37cb 169#ifdef CONFIG_MEMCG
bdce6d9e
KM
170DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end,
171
172 TP_PROTO(unsigned long nr_reclaimed),
173
174 TP_ARGS(nr_reclaimed)
175);
176
177DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reclaim_end,
178
179 TP_PROTO(unsigned long nr_reclaimed),
180
181 TP_ARGS(nr_reclaimed)
182);
f40a37cb 183#endif /* CONFIG_MEMCG */
bdce6d9e 184
09576073
DC
185TRACE_EVENT(mm_shrink_slab_start,
186 TP_PROTO(struct shrinker *shr, struct shrink_control *sc,
9092c71b
JB
187 long nr_objects_to_shrink, unsigned long cache_items,
188 unsigned long long delta, unsigned long total_scan,
189 int priority),
09576073 190
9092c71b
JB
191 TP_ARGS(shr, sc, nr_objects_to_shrink, cache_items, delta, total_scan,
192 priority),
09576073
DC
193
194 TP_STRUCT__entry(
195 __field(struct shrinker *, shr)
196 __field(void *, shrink)
df9024a8 197 __field(int, nid)
09576073
DC
198 __field(long, nr_objects_to_shrink)
199 __field(gfp_t, gfp_flags)
09576073
DC
200 __field(unsigned long, cache_items)
201 __field(unsigned long long, delta)
202 __field(unsigned long, total_scan)
9092c71b 203 __field(int, priority)
09576073
DC
204 ),
205
206 TP_fast_assign(
207 __entry->shr = shr;
a0b02131 208 __entry->shrink = shr->scan_objects;
df9024a8 209 __entry->nid = sc->nid;
09576073
DC
210 __entry->nr_objects_to_shrink = nr_objects_to_shrink;
211 __entry->gfp_flags = sc->gfp_mask;
09576073
DC
212 __entry->cache_items = cache_items;
213 __entry->delta = delta;
214 __entry->total_scan = total_scan;
9092c71b 215 __entry->priority = priority;
09576073
DC
216 ),
217
d75f773c 218 TP_printk("%pS %p: nid: %d objects to shrink %ld gfp_flags %s cache items %ld delta %lld total_scan %ld priority %d",
09576073
DC
219 __entry->shrink,
220 __entry->shr,
df9024a8 221 __entry->nid,
09576073
DC
222 __entry->nr_objects_to_shrink,
223 show_gfp_flags(__entry->gfp_flags),
09576073
DC
224 __entry->cache_items,
225 __entry->delta,
9092c71b
JB
226 __entry->total_scan,
227 __entry->priority)
09576073
DC
228);
229
230TRACE_EVENT(mm_shrink_slab_end,
df9024a8 231 TP_PROTO(struct shrinker *shr, int nid, int shrinker_retval,
7fe70475 232 long unused_scan_cnt, long new_scan_cnt, long total_scan),
09576073 233
df9024a8
DH
234 TP_ARGS(shr, nid, shrinker_retval, unused_scan_cnt, new_scan_cnt,
235 total_scan),
09576073
DC
236
237 TP_STRUCT__entry(
238 __field(struct shrinker *, shr)
df9024a8 239 __field(int, nid)
09576073
DC
240 __field(void *, shrink)
241 __field(long, unused_scan)
242 __field(long, new_scan)
243 __field(int, retval)
244 __field(long, total_scan)
245 ),
246
247 TP_fast_assign(
248 __entry->shr = shr;
df9024a8 249 __entry->nid = nid;
a0b02131 250 __entry->shrink = shr->scan_objects;
09576073
DC
251 __entry->unused_scan = unused_scan_cnt;
252 __entry->new_scan = new_scan_cnt;
253 __entry->retval = shrinker_retval;
7fe70475 254 __entry->total_scan = total_scan;
09576073
DC
255 ),
256
d75f773c 257 TP_printk("%pS %p: nid: %d unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d",
09576073
DC
258 __entry->shrink,
259 __entry->shr,
df9024a8 260 __entry->nid,
09576073
DC
261 __entry->unused_scan,
262 __entry->new_scan,
263 __entry->total_scan,
264 __entry->retval)
265);
bdce6d9e 266
30b9aed8 267TRACE_EVENT(mm_vmscan_lru_isolate,
97a225e6 268 TP_PROTO(int highest_zoneidx,
e5146b12 269 int order,
a8a94d15
MG
270 unsigned long nr_requested,
271 unsigned long nr_scanned,
1265e3a6 272 unsigned long nr_skipped,
a8a94d15 273 unsigned long nr_taken,
ea4d349f 274 isolate_mode_t isolate_mode,
32b3f297 275 int lru),
a8a94d15 276
97a225e6 277 TP_ARGS(highest_zoneidx, order, nr_requested, nr_scanned, nr_skipped, nr_taken, isolate_mode, lru),
a8a94d15
MG
278
279 TP_STRUCT__entry(
97a225e6 280 __field(int, highest_zoneidx)
a8a94d15
MG
281 __field(int, order)
282 __field(unsigned long, nr_requested)
283 __field(unsigned long, nr_scanned)
1265e3a6 284 __field(unsigned long, nr_skipped)
a8a94d15 285 __field(unsigned long, nr_taken)
4356f21d 286 __field(isolate_mode_t, isolate_mode)
32b3f297 287 __field(int, lru)
a8a94d15
MG
288 ),
289
290 TP_fast_assign(
97a225e6 291 __entry->highest_zoneidx = highest_zoneidx;
a8a94d15
MG
292 __entry->order = order;
293 __entry->nr_requested = nr_requested;
294 __entry->nr_scanned = nr_scanned;
1265e3a6 295 __entry->nr_skipped = nr_skipped;
a8a94d15 296 __entry->nr_taken = nr_taken;
a8a94d15 297 __entry->isolate_mode = isolate_mode;
32b3f297 298 __entry->lru = lru;
a8a94d15
MG
299 ),
300
97a225e6
JK
301 /*
302 * classzone is previous name of the highest_zoneidx.
303 * Reason not to change it is the ABI requirement of the tracepoint.
304 */
32b3f297 305 TP_printk("isolate_mode=%d classzone=%d order=%d nr_requested=%lu nr_scanned=%lu nr_skipped=%lu nr_taken=%lu lru=%s",
a8a94d15 306 __entry->isolate_mode,
97a225e6 307 __entry->highest_zoneidx,
a8a94d15
MG
308 __entry->order,
309 __entry->nr_requested,
310 __entry->nr_scanned,
1265e3a6 311 __entry->nr_skipped,
a8a94d15 312 __entry->nr_taken,
32b3f297 313 __print_symbolic(__entry->lru, LRU_NAMES))
a8a94d15
MG
314);
315
755f0225
MG
316TRACE_EVENT(mm_vmscan_writepage,
317
3aa23851 318 TP_PROTO(struct page *page),
755f0225 319
3aa23851 320 TP_ARGS(page),
755f0225
MG
321
322 TP_STRUCT__entry(
9fdd8a87 323 __field(unsigned long, pfn)
755f0225
MG
324 __field(int, reclaim_flags)
325 ),
326
327 TP_fast_assign(
9fdd8a87 328 __entry->pfn = page_to_pfn(page);
60b62ff7 329 __entry->reclaim_flags = trace_reclaim_flags(
9de4f22a 330 page_is_file_lru(page));
755f0225
MG
331 ),
332
53d884a6 333 TP_printk("page=%p pfn=0x%lx flags=%s",
9fdd8a87
NK
334 pfn_to_page(__entry->pfn),
335 __entry->pfn,
755f0225
MG
336 show_reclaim_flags(__entry->reclaim_flags))
337);
338
e11da5b4
MG
339TRACE_EVENT(mm_vmscan_lru_shrink_inactive,
340
599d0c95 341 TP_PROTO(int nid,
ba5e9579 342 unsigned long nr_scanned, unsigned long nr_reclaimed,
d51d1e64 343 struct reclaim_stat *stat, int priority, int file),
e11da5b4 344
d51d1e64 345 TP_ARGS(nid, nr_scanned, nr_reclaimed, stat, priority, file),
e11da5b4
MG
346
347 TP_STRUCT__entry(
348 __field(int, nid)
e11da5b4
MG
349 __field(unsigned long, nr_scanned)
350 __field(unsigned long, nr_reclaimed)
5bccd166
MH
351 __field(unsigned long, nr_dirty)
352 __field(unsigned long, nr_writeback)
353 __field(unsigned long, nr_congested)
354 __field(unsigned long, nr_immediate)
886cf190
KT
355 __field(unsigned int, nr_activate0)
356 __field(unsigned int, nr_activate1)
5bccd166
MH
357 __field(unsigned long, nr_ref_keep)
358 __field(unsigned long, nr_unmap_fail)
e11da5b4
MG
359 __field(int, priority)
360 __field(int, reclaim_flags)
361 ),
362
363 TP_fast_assign(
599d0c95 364 __entry->nid = nid;
e11da5b4
MG
365 __entry->nr_scanned = nr_scanned;
366 __entry->nr_reclaimed = nr_reclaimed;
d51d1e64
SR
367 __entry->nr_dirty = stat->nr_dirty;
368 __entry->nr_writeback = stat->nr_writeback;
369 __entry->nr_congested = stat->nr_congested;
370 __entry->nr_immediate = stat->nr_immediate;
886cf190
KT
371 __entry->nr_activate0 = stat->nr_activate[0];
372 __entry->nr_activate1 = stat->nr_activate[1];
d51d1e64
SR
373 __entry->nr_ref_keep = stat->nr_ref_keep;
374 __entry->nr_unmap_fail = stat->nr_unmap_fail;
e11da5b4 375 __entry->priority = priority;
60b62ff7 376 __entry->reclaim_flags = trace_reclaim_flags(file);
e11da5b4
MG
377 ),
378
886cf190 379 TP_printk("nid=%d nr_scanned=%ld nr_reclaimed=%ld nr_dirty=%ld nr_writeback=%ld nr_congested=%ld nr_immediate=%ld nr_activate_anon=%d nr_activate_file=%d nr_ref_keep=%ld nr_unmap_fail=%ld priority=%d flags=%s",
599d0c95 380 __entry->nid,
e11da5b4 381 __entry->nr_scanned, __entry->nr_reclaimed,
5bccd166
MH
382 __entry->nr_dirty, __entry->nr_writeback,
383 __entry->nr_congested, __entry->nr_immediate,
886cf190
KT
384 __entry->nr_activate0, __entry->nr_activate1,
385 __entry->nr_ref_keep, __entry->nr_unmap_fail,
386 __entry->priority,
e11da5b4
MG
387 show_reclaim_flags(__entry->reclaim_flags))
388);
389
9d998b4f
MH
390TRACE_EVENT(mm_vmscan_lru_shrink_active,
391
392 TP_PROTO(int nid, unsigned long nr_taken,
393 unsigned long nr_active, unsigned long nr_deactivated,
394 unsigned long nr_referenced, int priority, int file),
395
396 TP_ARGS(nid, nr_taken, nr_active, nr_deactivated, nr_referenced, priority, file),
397
398 TP_STRUCT__entry(
399 __field(int, nid)
400 __field(unsigned long, nr_taken)
401 __field(unsigned long, nr_active)
402 __field(unsigned long, nr_deactivated)
403 __field(unsigned long, nr_referenced)
404 __field(int, priority)
405 __field(int, reclaim_flags)
406 ),
407
408 TP_fast_assign(
409 __entry->nid = nid;
410 __entry->nr_taken = nr_taken;
411 __entry->nr_active = nr_active;
412 __entry->nr_deactivated = nr_deactivated;
413 __entry->nr_referenced = nr_referenced;
414 __entry->priority = priority;
60b62ff7 415 __entry->reclaim_flags = trace_reclaim_flags(file);
9d998b4f
MH
416 ),
417
418 TP_printk("nid=%d nr_taken=%ld nr_active=%ld nr_deactivated=%ld nr_referenced=%ld priority=%d flags=%s",
419 __entry->nid,
420 __entry->nr_taken,
421 __entry->nr_active, __entry->nr_deactivated, __entry->nr_referenced,
422 __entry->priority,
423 show_reclaim_flags(__entry->reclaim_flags))
424);
425
132bb8cf
YS
426TRACE_EVENT(mm_vmscan_node_reclaim_begin,
427
428 TP_PROTO(int nid, int order, gfp_t gfp_flags),
429
430 TP_ARGS(nid, order, gfp_flags),
431
432 TP_STRUCT__entry(
433 __field(int, nid)
434 __field(int, order)
435 __field(gfp_t, gfp_flags)
436 ),
437
438 TP_fast_assign(
439 __entry->nid = nid;
440 __entry->order = order;
441 __entry->gfp_flags = gfp_flags;
442 ),
443
444 TP_printk("nid=%d order=%d gfp_flags=%s",
445 __entry->nid,
446 __entry->order,
447 show_gfp_flags(__entry->gfp_flags))
448);
449
450DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_node_reclaim_end,
451
452 TP_PROTO(unsigned long nr_reclaimed),
453
454 TP_ARGS(nr_reclaimed)
455);
456
33906bc5
MG
457#endif /* _TRACE_VMSCAN_H */
458
459/* This part must be outside protection */
460#include <trace/define_trace.h>