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