]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
7b2a2d4a MG |
2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM migrate | |
4 | ||
5 | #if !defined(_TRACE_MIGRATE_H) || defined(TRACE_HEADER_MULTI_READ) | |
6 | #define _TRACE_MIGRATE_H | |
7 | ||
8643e92b SRRH |
8 | #include <linux/tracepoint.h> |
9 | ||
7b2a2d4a | 10 | #define MIGRATE_MODE \ |
190f0b76 SRRH |
11 | EM( MIGRATE_ASYNC, "MIGRATE_ASYNC") \ |
12 | EM( MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT") \ | |
13 | EMe(MIGRATE_SYNC, "MIGRATE_SYNC") | |
14 | ||
7b2a2d4a MG |
15 | |
16 | #define MIGRATE_REASON \ | |
190f0b76 SRRH |
17 | EM( MR_COMPACTION, "compaction") \ |
18 | EM( MR_MEMORY_FAILURE, "memory_failure") \ | |
19 | EM( MR_MEMORY_HOTPLUG, "memory_hotplug") \ | |
20 | EM( MR_SYSCALL, "syscall_or_cpuset") \ | |
21 | EM( MR_MEMPOLICY_MBIND, "mempolicy_mbind") \ | |
22 | EM( MR_NUMA_MISPLACED, "numa_misplaced") \ | |
d1e153fe | 23 | EM( MR_CONTIG_RANGE, "contig_range") \ |
26aa2d19 DH |
24 | EM( MR_LONGTERM_PIN, "longterm_pin") \ |
25 | EMe(MR_DEMOTION, "demotion") | |
190f0b76 SRRH |
26 | |
27 | /* | |
28 | * First define the enums in the above macros to be exported to userspace | |
29 | * via TRACE_DEFINE_ENUM(). | |
30 | */ | |
31 | #undef EM | |
32 | #undef EMe | |
33 | #define EM(a, b) TRACE_DEFINE_ENUM(a); | |
34 | #define EMe(a, b) TRACE_DEFINE_ENUM(a); | |
35 | ||
36 | MIGRATE_MODE | |
37 | MIGRATE_REASON | |
38 | ||
39 | /* | |
40 | * Now redefine the EM() and EMe() macros to map the enums to the strings | |
41 | * that will be printed in the output. | |
42 | */ | |
43 | #undef EM | |
44 | #undef EMe | |
45 | #define EM(a, b) {a, b}, | |
46 | #define EMe(a, b) {a, b} | |
7b2a2d4a MG |
47 | |
48 | TRACE_EVENT(mm_migrate_pages, | |
49 | ||
50 | TP_PROTO(unsigned long succeeded, unsigned long failed, | |
1a5bae25 AK |
51 | unsigned long thp_succeeded, unsigned long thp_failed, |
52 | unsigned long thp_split, enum migrate_mode mode, int reason), | |
7b2a2d4a | 53 | |
1a5bae25 AK |
54 | TP_ARGS(succeeded, failed, thp_succeeded, thp_failed, |
55 | thp_split, mode, reason), | |
7b2a2d4a MG |
56 | |
57 | TP_STRUCT__entry( | |
58 | __field( unsigned long, succeeded) | |
59 | __field( unsigned long, failed) | |
1a5bae25 AK |
60 | __field( unsigned long, thp_succeeded) |
61 | __field( unsigned long, thp_failed) | |
62 | __field( unsigned long, thp_split) | |
7b2a2d4a MG |
63 | __field( enum migrate_mode, mode) |
64 | __field( int, reason) | |
65 | ), | |
66 | ||
67 | TP_fast_assign( | |
68 | __entry->succeeded = succeeded; | |
69 | __entry->failed = failed; | |
1a5bae25 AK |
70 | __entry->thp_succeeded = thp_succeeded; |
71 | __entry->thp_failed = thp_failed; | |
72 | __entry->thp_split = thp_split; | |
7b2a2d4a MG |
73 | __entry->mode = mode; |
74 | __entry->reason = reason; | |
75 | ), | |
76 | ||
1a5bae25 | 77 | TP_printk("nr_succeeded=%lu nr_failed=%lu nr_thp_succeeded=%lu nr_thp_failed=%lu nr_thp_split=%lu mode=%s reason=%s", |
7b2a2d4a MG |
78 | __entry->succeeded, |
79 | __entry->failed, | |
1a5bae25 AK |
80 | __entry->thp_succeeded, |
81 | __entry->thp_failed, | |
82 | __entry->thp_split, | |
7b2a2d4a MG |
83 | __print_symbolic(__entry->mode, MIGRATE_MODE), |
84 | __print_symbolic(__entry->reason, MIGRATE_REASON)) | |
85 | ); | |
7bc1aec5 LM |
86 | |
87 | TRACE_EVENT(mm_migrate_pages_start, | |
88 | ||
89 | TP_PROTO(enum migrate_mode mode, int reason), | |
90 | ||
91 | TP_ARGS(mode, reason), | |
92 | ||
93 | TP_STRUCT__entry( | |
94 | __field(enum migrate_mode, mode) | |
95 | __field(int, reason) | |
96 | ), | |
97 | ||
98 | TP_fast_assign( | |
99 | __entry->mode = mode; | |
100 | __entry->reason = reason; | |
101 | ), | |
102 | ||
103 | TP_printk("mode=%s reason=%s", | |
104 | __print_symbolic(__entry->mode, MIGRATE_MODE), | |
105 | __print_symbolic(__entry->reason, MIGRATE_REASON)) | |
106 | ); | |
107 | ||
7b2a2d4a MG |
108 | #endif /* _TRACE_MIGRATE_H */ |
109 | ||
110 | /* This part must be outside protection */ | |
111 | #include <trace/define_trace.h> |