xref: /openbmc/linux/include/trace/events/migrate.h (revision 4f3db074)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM migrate
3 
4 #if !defined(_TRACE_MIGRATE_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_MIGRATE_H
6 
7 #include <linux/tracepoint.h>
8 
9 #define MIGRATE_MODE						\
10 	EM( MIGRATE_ASYNC,	"MIGRATE_ASYNC")		\
11 	EM( MIGRATE_SYNC_LIGHT,	"MIGRATE_SYNC_LIGHT")		\
12 	EMe(MIGRATE_SYNC,	"MIGRATE_SYNC")
13 
14 
15 #define MIGRATE_REASON						\
16 	EM( MR_COMPACTION,	"compaction")			\
17 	EM( MR_MEMORY_FAILURE,	"memory_failure")		\
18 	EM( MR_MEMORY_HOTPLUG,	"memory_hotplug")		\
19 	EM( MR_SYSCALL,		"syscall_or_cpuset")		\
20 	EM( MR_MEMPOLICY_MBIND,	"mempolicy_mbind")		\
21 	EM( MR_NUMA_MISPLACED,	"numa_misplaced")		\
22 	EMe(MR_CMA,		"cma")
23 
24 /*
25  * First define the enums in the above macros to be exported to userspace
26  * via TRACE_DEFINE_ENUM().
27  */
28 #undef EM
29 #undef EMe
30 #define EM(a, b)	TRACE_DEFINE_ENUM(a);
31 #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
32 
33 MIGRATE_MODE
34 MIGRATE_REASON
35 
36 /*
37  * Now redefine the EM() and EMe() macros to map the enums to the strings
38  * that will be printed in the output.
39  */
40 #undef EM
41 #undef EMe
42 #define EM(a, b)	{a, b},
43 #define EMe(a, b)	{a, b}
44 
45 TRACE_EVENT(mm_migrate_pages,
46 
47 	TP_PROTO(unsigned long succeeded, unsigned long failed,
48 		 enum migrate_mode mode, int reason),
49 
50 	TP_ARGS(succeeded, failed, mode, reason),
51 
52 	TP_STRUCT__entry(
53 		__field(	unsigned long,		succeeded)
54 		__field(	unsigned long,		failed)
55 		__field(	enum migrate_mode,	mode)
56 		__field(	int,			reason)
57 	),
58 
59 	TP_fast_assign(
60 		__entry->succeeded	= succeeded;
61 		__entry->failed		= failed;
62 		__entry->mode		= mode;
63 		__entry->reason		= reason;
64 	),
65 
66 	TP_printk("nr_succeeded=%lu nr_failed=%lu mode=%s reason=%s",
67 		__entry->succeeded,
68 		__entry->failed,
69 		__print_symbolic(__entry->mode, MIGRATE_MODE),
70 		__print_symbolic(__entry->reason, MIGRATE_REASON))
71 );
72 
73 TRACE_EVENT(mm_numa_migrate_ratelimit,
74 
75 	TP_PROTO(struct task_struct *p, int dst_nid, unsigned long nr_pages),
76 
77 	TP_ARGS(p, dst_nid, nr_pages),
78 
79 	TP_STRUCT__entry(
80 		__array(	char,		comm,	TASK_COMM_LEN)
81 		__field(	pid_t,		pid)
82 		__field(	int,		dst_nid)
83 		__field(	unsigned long,	nr_pages)
84 	),
85 
86 	TP_fast_assign(
87 		memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
88 		__entry->pid		= p->pid;
89 		__entry->dst_nid	= dst_nid;
90 		__entry->nr_pages	= nr_pages;
91 	),
92 
93 	TP_printk("comm=%s pid=%d dst_nid=%d nr_pages=%lu",
94 		__entry->comm,
95 		__entry->pid,
96 		__entry->dst_nid,
97 		__entry->nr_pages)
98 );
99 #endif /* _TRACE_MIGRATE_H */
100 
101 /* This part must be outside protection */
102 #include <trace/define_trace.h>
103