1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM migrate
5 #if !defined(_TRACE_MIGRATE_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_MIGRATE_H
8 #include <linux/tracepoint.h>
10 #define MIGRATE_MODE \
11 EM( MIGRATE_ASYNC, "MIGRATE_ASYNC") \
12 EM( MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT") \
13 EMe(MIGRATE_SYNC, "MIGRATE_SYNC")
16 #define MIGRATE_REASON \
17 EM( MR_COMPACTION, "compaction") \
18 EM( MR_MEMORY_FAILURE, "memory_failure") \
19 EM( MR_MEMORY_HOTPLUG, "memory_hotplug") \
20 EM( MR_SYSCALL, "syscall_or_cpuset") \
21 EM( MR_MEMPOLICY_MBIND, "mempolicy_mbind") \
22 EM( MR_NUMA_MISPLACED, "numa_misplaced") \
23 EMe(MR_CONTIG_RANGE, "contig_range")
26 * First define the enums in the above macros to be exported to userspace
27 * via TRACE_DEFINE_ENUM().
31 #define EM(a, b) TRACE_DEFINE_ENUM(a);
32 #define EMe(a, b) TRACE_DEFINE_ENUM(a);
38 * Now redefine the EM() and EMe() macros to map the enums to the strings
39 * that will be printed in the output.
43 #define EM(a, b) {a, b},
44 #define EMe(a, b) {a, b}
46 TRACE_EVENT(mm_migrate_pages
,
48 TP_PROTO(unsigned long succeeded
, unsigned long failed
,
49 enum migrate_mode mode
, int reason
),
51 TP_ARGS(succeeded
, failed
, mode
, reason
),
54 __field( unsigned long, succeeded
)
55 __field( unsigned long, failed
)
56 __field( enum migrate_mode
, mode
)
61 __entry
->succeeded
= succeeded
;
62 __entry
->failed
= failed
;
64 __entry
->reason
= reason
;
67 TP_printk("nr_succeeded=%lu nr_failed=%lu mode=%s reason=%s",
70 __print_symbolic(__entry
->mode
, MIGRATE_MODE
),
71 __print_symbolic(__entry
->reason
, MIGRATE_REASON
))
73 #endif /* _TRACE_MIGRATE_H */
75 /* This part must be outside protection */
76 #include <trace/define_trace.h>