xref: /openbmc/linux/include/trace/events/migrate.h (revision 455f9726)
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 	{MIGRATE_ASYNC,		"MIGRATE_ASYNC"},		\
11 	{MIGRATE_SYNC_LIGHT,	"MIGRATE_SYNC_LIGHT"},		\
12 	{MIGRATE_SYNC,		"MIGRATE_SYNC"}
13 
14 #define MIGRATE_REASON						\
15 	{MR_COMPACTION,		"compaction"},			\
16 	{MR_MEMORY_FAILURE,	"memory_failure"},		\
17 	{MR_MEMORY_HOTPLUG,	"memory_hotplug"},		\
18 	{MR_SYSCALL,		"syscall_or_cpuset"},		\
19 	{MR_MEMPOLICY_MBIND,	"mempolicy_mbind"},		\
20 	{MR_CMA,		"cma"}
21 
22 TRACE_EVENT(mm_migrate_pages,
23 
24 	TP_PROTO(unsigned long succeeded, unsigned long failed,
25 		 enum migrate_mode mode, int reason),
26 
27 	TP_ARGS(succeeded, failed, mode, reason),
28 
29 	TP_STRUCT__entry(
30 		__field(	unsigned long,		succeeded)
31 		__field(	unsigned long,		failed)
32 		__field(	enum migrate_mode,	mode)
33 		__field(	int,			reason)
34 	),
35 
36 	TP_fast_assign(
37 		__entry->succeeded	= succeeded;
38 		__entry->failed		= failed;
39 		__entry->mode		= mode;
40 		__entry->reason		= reason;
41 	),
42 
43 	TP_printk("nr_succeeded=%lu nr_failed=%lu mode=%s reason=%s",
44 		__entry->succeeded,
45 		__entry->failed,
46 		__print_symbolic(__entry->mode, MIGRATE_MODE),
47 		__print_symbolic(__entry->reason, MIGRATE_REASON))
48 );
49 
50 TRACE_EVENT(mm_numa_migrate_ratelimit,
51 
52 	TP_PROTO(struct task_struct *p, int dst_nid, unsigned long nr_pages),
53 
54 	TP_ARGS(p, dst_nid, nr_pages),
55 
56 	TP_STRUCT__entry(
57 		__array(	char,		comm,	TASK_COMM_LEN)
58 		__field(	pid_t,		pid)
59 		__field(	int,		dst_nid)
60 		__field(	unsigned long,	nr_pages)
61 	),
62 
63 	TP_fast_assign(
64 		memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
65 		__entry->pid		= p->pid;
66 		__entry->dst_nid	= dst_nid;
67 		__entry->nr_pages	= nr_pages;
68 	),
69 
70 	TP_printk("comm=%s pid=%d dst_nid=%d nr_pages=%lu",
71 		__entry->comm,
72 		__entry->pid,
73 		__entry->dst_nid,
74 		__entry->nr_pages)
75 );
76 #endif /* _TRACE_MIGRATE_H */
77 
78 /* This part must be outside protection */
79 #include <trace/define_trace.h>
80