xref: /openbmc/linux/include/trace/events/migrate.h (revision d1e153fea2a8940273174fc17733c44323d35cd5)
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")		\
23*d1e153feSPavel Tatashin 	EM( MR_CONTIG_RANGE,	"contig_range")			\
24*d1e153feSPavel Tatashin 	EMe(MR_LONGTERM_PIN,	"longterm_pin")
25190f0b76SSteven Rostedt (Red Hat) 
26190f0b76SSteven Rostedt (Red Hat) /*
27190f0b76SSteven Rostedt (Red Hat)  * First define the enums in the above macros to be exported to userspace
28190f0b76SSteven Rostedt (Red Hat)  * via TRACE_DEFINE_ENUM().
29190f0b76SSteven Rostedt (Red Hat)  */
30190f0b76SSteven Rostedt (Red Hat) #undef EM
31190f0b76SSteven Rostedt (Red Hat) #undef EMe
32190f0b76SSteven Rostedt (Red Hat) #define EM(a, b)	TRACE_DEFINE_ENUM(a);
33190f0b76SSteven Rostedt (Red Hat) #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
34190f0b76SSteven Rostedt (Red Hat) 
35190f0b76SSteven Rostedt (Red Hat) MIGRATE_MODE
36190f0b76SSteven Rostedt (Red Hat) MIGRATE_REASON
37190f0b76SSteven Rostedt (Red Hat) 
38190f0b76SSteven Rostedt (Red Hat) /*
39190f0b76SSteven Rostedt (Red Hat)  * Now redefine the EM() and EMe() macros to map the enums to the strings
40190f0b76SSteven Rostedt (Red Hat)  * that will be printed in the output.
41190f0b76SSteven Rostedt (Red Hat)  */
42190f0b76SSteven Rostedt (Red Hat) #undef EM
43190f0b76SSteven Rostedt (Red Hat) #undef EMe
44190f0b76SSteven Rostedt (Red Hat) #define EM(a, b)	{a, b},
45190f0b76SSteven Rostedt (Red Hat) #define EMe(a, b)	{a, b}
467b2a2d4aSMel Gorman 
477b2a2d4aSMel Gorman TRACE_EVENT(mm_migrate_pages,
487b2a2d4aSMel Gorman 
497b2a2d4aSMel Gorman 	TP_PROTO(unsigned long succeeded, unsigned long failed,
501a5bae25SAnshuman Khandual 		 unsigned long thp_succeeded, unsigned long thp_failed,
511a5bae25SAnshuman Khandual 		 unsigned long thp_split, enum migrate_mode mode, int reason),
527b2a2d4aSMel Gorman 
531a5bae25SAnshuman Khandual 	TP_ARGS(succeeded, failed, thp_succeeded, thp_failed,
541a5bae25SAnshuman Khandual 		thp_split, mode, reason),
557b2a2d4aSMel Gorman 
567b2a2d4aSMel Gorman 	TP_STRUCT__entry(
577b2a2d4aSMel Gorman 		__field(	unsigned long,		succeeded)
587b2a2d4aSMel Gorman 		__field(	unsigned long,		failed)
591a5bae25SAnshuman Khandual 		__field(	unsigned long,		thp_succeeded)
601a5bae25SAnshuman Khandual 		__field(	unsigned long,		thp_failed)
611a5bae25SAnshuman Khandual 		__field(	unsigned long,		thp_split)
627b2a2d4aSMel Gorman 		__field(	enum migrate_mode,	mode)
637b2a2d4aSMel Gorman 		__field(	int,			reason)
647b2a2d4aSMel Gorman 	),
657b2a2d4aSMel Gorman 
667b2a2d4aSMel Gorman 	TP_fast_assign(
677b2a2d4aSMel Gorman 		__entry->succeeded	= succeeded;
687b2a2d4aSMel Gorman 		__entry->failed		= failed;
691a5bae25SAnshuman Khandual 		__entry->thp_succeeded	= thp_succeeded;
701a5bae25SAnshuman Khandual 		__entry->thp_failed	= thp_failed;
711a5bae25SAnshuman Khandual 		__entry->thp_split	= thp_split;
727b2a2d4aSMel Gorman 		__entry->mode		= mode;
737b2a2d4aSMel Gorman 		__entry->reason		= reason;
747b2a2d4aSMel Gorman 	),
757b2a2d4aSMel Gorman 
761a5bae25SAnshuman 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",
777b2a2d4aSMel Gorman 		__entry->succeeded,
787b2a2d4aSMel Gorman 		__entry->failed,
791a5bae25SAnshuman Khandual 		__entry->thp_succeeded,
801a5bae25SAnshuman Khandual 		__entry->thp_failed,
811a5bae25SAnshuman Khandual 		__entry->thp_split,
827b2a2d4aSMel Gorman 		__print_symbolic(__entry->mode, MIGRATE_MODE),
837b2a2d4aSMel Gorman 		__print_symbolic(__entry->reason, MIGRATE_REASON))
847b2a2d4aSMel Gorman );
857bc1aec5SLiam Mark 
867bc1aec5SLiam Mark TRACE_EVENT(mm_migrate_pages_start,
877bc1aec5SLiam Mark 
887bc1aec5SLiam Mark 	TP_PROTO(enum migrate_mode mode, int reason),
897bc1aec5SLiam Mark 
907bc1aec5SLiam Mark 	TP_ARGS(mode, reason),
917bc1aec5SLiam Mark 
927bc1aec5SLiam Mark 	TP_STRUCT__entry(
937bc1aec5SLiam Mark 		__field(enum migrate_mode, mode)
947bc1aec5SLiam Mark 		__field(int, reason)
957bc1aec5SLiam Mark 	),
967bc1aec5SLiam Mark 
977bc1aec5SLiam Mark 	TP_fast_assign(
987bc1aec5SLiam Mark 		__entry->mode	= mode;
997bc1aec5SLiam Mark 		__entry->reason	= reason;
1007bc1aec5SLiam Mark 	),
1017bc1aec5SLiam Mark 
1027bc1aec5SLiam Mark 	TP_printk("mode=%s reason=%s",
1037bc1aec5SLiam Mark 		  __print_symbolic(__entry->mode, MIGRATE_MODE),
1047bc1aec5SLiam Mark 		  __print_symbolic(__entry->reason, MIGRATE_REASON))
1057bc1aec5SLiam Mark );
1067bc1aec5SLiam Mark 
1077b2a2d4aSMel Gorman #endif /* _TRACE_MIGRATE_H */
1087b2a2d4aSMel Gorman 
1097b2a2d4aSMel Gorman /* This part must be outside protection */
1107b2a2d4aSMel Gorman #include <trace/define_trace.h>
111