xref: /openbmc/linux/include/trace/events/migrate.h (revision 7bc1aec5e28765ad18742824b3b972471807a632)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
27b2a2d4aSMel Gorman #undef TRACE_SYSTEM
37b2a2d4aSMel Gorman #define TRACE_SYSTEM migrate
47b2a2d4aSMel Gorman 
57b2a2d4aSMel Gorman #if !defined(_TRACE_MIGRATE_H) || defined(TRACE_HEADER_MULTI_READ)
67b2a2d4aSMel Gorman #define _TRACE_MIGRATE_H
77b2a2d4aSMel Gorman 
88643e92bSSteven Rostedt (Red Hat) #include <linux/tracepoint.h>
98643e92bSSteven Rostedt (Red Hat) 
107b2a2d4aSMel Gorman #define MIGRATE_MODE						\
11190f0b76SSteven Rostedt (Red Hat) 	EM( MIGRATE_ASYNC,	"MIGRATE_ASYNC")		\
12190f0b76SSteven Rostedt (Red Hat) 	EM( MIGRATE_SYNC_LIGHT,	"MIGRATE_SYNC_LIGHT")		\
13190f0b76SSteven Rostedt (Red Hat) 	EMe(MIGRATE_SYNC,	"MIGRATE_SYNC")
14190f0b76SSteven Rostedt (Red Hat) 
157b2a2d4aSMel Gorman 
167b2a2d4aSMel Gorman #define MIGRATE_REASON						\
17190f0b76SSteven Rostedt (Red Hat) 	EM( MR_COMPACTION,	"compaction")			\
18190f0b76SSteven Rostedt (Red Hat) 	EM( MR_MEMORY_FAILURE,	"memory_failure")		\
19190f0b76SSteven Rostedt (Red Hat) 	EM( MR_MEMORY_HOTPLUG,	"memory_hotplug")		\
20190f0b76SSteven Rostedt (Red Hat) 	EM( MR_SYSCALL,		"syscall_or_cpuset")		\
21190f0b76SSteven Rostedt (Red Hat) 	EM( MR_MEMPOLICY_MBIND,	"mempolicy_mbind")		\
22190f0b76SSteven Rostedt (Red Hat) 	EM( MR_NUMA_MISPLACED,	"numa_misplaced")		\
2331025351SAnshuman Khandual 	EMe(MR_CONTIG_RANGE,	"contig_range")
24190f0b76SSteven Rostedt (Red Hat) 
25190f0b76SSteven Rostedt (Red Hat) /*
26190f0b76SSteven Rostedt (Red Hat)  * First define the enums in the above macros to be exported to userspace
27190f0b76SSteven Rostedt (Red Hat)  * via TRACE_DEFINE_ENUM().
28190f0b76SSteven Rostedt (Red Hat)  */
29190f0b76SSteven Rostedt (Red Hat) #undef EM
30190f0b76SSteven Rostedt (Red Hat) #undef EMe
31190f0b76SSteven Rostedt (Red Hat) #define EM(a, b)	TRACE_DEFINE_ENUM(a);
32190f0b76SSteven Rostedt (Red Hat) #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
33190f0b76SSteven Rostedt (Red Hat) 
34190f0b76SSteven Rostedt (Red Hat) MIGRATE_MODE
35190f0b76SSteven Rostedt (Red Hat) MIGRATE_REASON
36190f0b76SSteven Rostedt (Red Hat) 
37190f0b76SSteven Rostedt (Red Hat) /*
38190f0b76SSteven Rostedt (Red Hat)  * Now redefine the EM() and EMe() macros to map the enums to the strings
39190f0b76SSteven Rostedt (Red Hat)  * that will be printed in the output.
40190f0b76SSteven Rostedt (Red Hat)  */
41190f0b76SSteven Rostedt (Red Hat) #undef EM
42190f0b76SSteven Rostedt (Red Hat) #undef EMe
43190f0b76SSteven Rostedt (Red Hat) #define EM(a, b)	{a, b},
44190f0b76SSteven Rostedt (Red Hat) #define EMe(a, b)	{a, b}
457b2a2d4aSMel Gorman 
467b2a2d4aSMel Gorman TRACE_EVENT(mm_migrate_pages,
477b2a2d4aSMel Gorman 
487b2a2d4aSMel Gorman 	TP_PROTO(unsigned long succeeded, unsigned long failed,
491a5bae25SAnshuman Khandual 		 unsigned long thp_succeeded, unsigned long thp_failed,
501a5bae25SAnshuman Khandual 		 unsigned long thp_split, enum migrate_mode mode, int reason),
517b2a2d4aSMel Gorman 
521a5bae25SAnshuman Khandual 	TP_ARGS(succeeded, failed, thp_succeeded, thp_failed,
531a5bae25SAnshuman Khandual 		thp_split, mode, reason),
547b2a2d4aSMel Gorman 
557b2a2d4aSMel Gorman 	TP_STRUCT__entry(
567b2a2d4aSMel Gorman 		__field(	unsigned long,		succeeded)
577b2a2d4aSMel Gorman 		__field(	unsigned long,		failed)
581a5bae25SAnshuman Khandual 		__field(	unsigned long,		thp_succeeded)
591a5bae25SAnshuman Khandual 		__field(	unsigned long,		thp_failed)
601a5bae25SAnshuman Khandual 		__field(	unsigned long,		thp_split)
617b2a2d4aSMel Gorman 		__field(	enum migrate_mode,	mode)
627b2a2d4aSMel Gorman 		__field(	int,			reason)
637b2a2d4aSMel Gorman 	),
647b2a2d4aSMel Gorman 
657b2a2d4aSMel Gorman 	TP_fast_assign(
667b2a2d4aSMel Gorman 		__entry->succeeded	= succeeded;
677b2a2d4aSMel Gorman 		__entry->failed		= failed;
681a5bae25SAnshuman Khandual 		__entry->thp_succeeded	= thp_succeeded;
691a5bae25SAnshuman Khandual 		__entry->thp_failed	= thp_failed;
701a5bae25SAnshuman Khandual 		__entry->thp_split	= thp_split;
717b2a2d4aSMel Gorman 		__entry->mode		= mode;
727b2a2d4aSMel Gorman 		__entry->reason		= reason;
737b2a2d4aSMel Gorman 	),
747b2a2d4aSMel Gorman 
751a5bae25SAnshuman Khandual 	TP_printk("nr_succeeded=%lu nr_failed=%lu nr_thp_succeeded=%lu nr_thp_failed=%lu nr_thp_split=%lu mode=%s reason=%s",
767b2a2d4aSMel Gorman 		__entry->succeeded,
777b2a2d4aSMel Gorman 		__entry->failed,
781a5bae25SAnshuman Khandual 		__entry->thp_succeeded,
791a5bae25SAnshuman Khandual 		__entry->thp_failed,
801a5bae25SAnshuman Khandual 		__entry->thp_split,
817b2a2d4aSMel Gorman 		__print_symbolic(__entry->mode, MIGRATE_MODE),
827b2a2d4aSMel Gorman 		__print_symbolic(__entry->reason, MIGRATE_REASON))
837b2a2d4aSMel Gorman );
84*7bc1aec5SLiam Mark 
85*7bc1aec5SLiam Mark TRACE_EVENT(mm_migrate_pages_start,
86*7bc1aec5SLiam Mark 
87*7bc1aec5SLiam Mark 	TP_PROTO(enum migrate_mode mode, int reason),
88*7bc1aec5SLiam Mark 
89*7bc1aec5SLiam Mark 	TP_ARGS(mode, reason),
90*7bc1aec5SLiam Mark 
91*7bc1aec5SLiam Mark 	TP_STRUCT__entry(
92*7bc1aec5SLiam Mark 		__field(enum migrate_mode, mode)
93*7bc1aec5SLiam Mark 		__field(int, reason)
94*7bc1aec5SLiam Mark 	),
95*7bc1aec5SLiam Mark 
96*7bc1aec5SLiam Mark 	TP_fast_assign(
97*7bc1aec5SLiam Mark 		__entry->mode	= mode;
98*7bc1aec5SLiam Mark 		__entry->reason	= reason;
99*7bc1aec5SLiam Mark 	),
100*7bc1aec5SLiam Mark 
101*7bc1aec5SLiam Mark 	TP_printk("mode=%s reason=%s",
102*7bc1aec5SLiam Mark 		  __print_symbolic(__entry->mode, MIGRATE_MODE),
103*7bc1aec5SLiam Mark 		  __print_symbolic(__entry->reason, MIGRATE_REASON))
104*7bc1aec5SLiam Mark );
105*7bc1aec5SLiam Mark 
1067b2a2d4aSMel Gorman #endif /* _TRACE_MIGRATE_H */
1077b2a2d4aSMel Gorman 
1087b2a2d4aSMel Gorman /* This part must be outside protection */
1097b2a2d4aSMel Gorman #include <trace/define_trace.h>
110