Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Mel Gorman | 7b2a2d4 | 2012-10-19 14:07:31 +0100 | [diff] [blame] | 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 | |
Steven Rostedt (Red Hat) | 8643e92 | 2014-02-26 13:03:32 -0500 | [diff] [blame] | 8 | #include <linux/tracepoint.h> |
| 9 | |
Mel Gorman | 7b2a2d4 | 2012-10-19 14:07:31 +0100 | [diff] [blame] | 10 | #define MIGRATE_MODE \ |
Steven Rostedt (Red Hat) | 190f0b7 | 2015-03-27 16:48:57 -0400 | [diff] [blame] | 11 | EM( MIGRATE_ASYNC, "MIGRATE_ASYNC") \ |
| 12 | EM( MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT") \ |
| 13 | EMe(MIGRATE_SYNC, "MIGRATE_SYNC") |
| 14 | |
Mel Gorman | 7b2a2d4 | 2012-10-19 14:07:31 +0100 | [diff] [blame] | 15 | |
| 16 | #define MIGRATE_REASON \ |
Steven Rostedt (Red Hat) | 190f0b7 | 2015-03-27 16:48:57 -0400 | [diff] [blame] | 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") \ |
Anshuman Khandual | 3102535 | 2018-04-05 16:22:08 -0700 | [diff] [blame] | 23 | EMe(MR_CONTIG_RANGE, "contig_range") |
Steven Rostedt (Red Hat) | 190f0b7 | 2015-03-27 16:48:57 -0400 | [diff] [blame] | 24 | |
| 25 | /* |
| 26 | * First define the enums in the above macros to be exported to userspace |
| 27 | * via TRACE_DEFINE_ENUM(). |
| 28 | */ |
| 29 | #undef EM |
| 30 | #undef EMe |
| 31 | #define EM(a, b) TRACE_DEFINE_ENUM(a); |
| 32 | #define EMe(a, b) TRACE_DEFINE_ENUM(a); |
| 33 | |
| 34 | MIGRATE_MODE |
| 35 | MIGRATE_REASON |
| 36 | |
| 37 | /* |
| 38 | * Now redefine the EM() and EMe() macros to map the enums to the strings |
| 39 | * that will be printed in the output. |
| 40 | */ |
| 41 | #undef EM |
| 42 | #undef EMe |
| 43 | #define EM(a, b) {a, b}, |
| 44 | #define EMe(a, b) {a, b} |
Mel Gorman | 7b2a2d4 | 2012-10-19 14:07:31 +0100 | [diff] [blame] | 45 | |
| 46 | TRACE_EVENT(mm_migrate_pages, |
| 47 | |
| 48 | TP_PROTO(unsigned long succeeded, unsigned long failed, |
Anshuman Khandual | 1a5bae2 | 2020-08-11 18:31:51 -0700 | [diff] [blame] | 49 | unsigned long thp_succeeded, unsigned long thp_failed, |
| 50 | unsigned long thp_split, enum migrate_mode mode, int reason), |
Mel Gorman | 7b2a2d4 | 2012-10-19 14:07:31 +0100 | [diff] [blame] | 51 | |
Anshuman Khandual | 1a5bae2 | 2020-08-11 18:31:51 -0700 | [diff] [blame] | 52 | TP_ARGS(succeeded, failed, thp_succeeded, thp_failed, |
| 53 | thp_split, mode, reason), |
Mel Gorman | 7b2a2d4 | 2012-10-19 14:07:31 +0100 | [diff] [blame] | 54 | |
| 55 | TP_STRUCT__entry( |
| 56 | __field( unsigned long, succeeded) |
| 57 | __field( unsigned long, failed) |
Anshuman Khandual | 1a5bae2 | 2020-08-11 18:31:51 -0700 | [diff] [blame] | 58 | __field( unsigned long, thp_succeeded) |
| 59 | __field( unsigned long, thp_failed) |
| 60 | __field( unsigned long, thp_split) |
Mel Gorman | 7b2a2d4 | 2012-10-19 14:07:31 +0100 | [diff] [blame] | 61 | __field( enum migrate_mode, mode) |
| 62 | __field( int, reason) |
| 63 | ), |
| 64 | |
| 65 | TP_fast_assign( |
| 66 | __entry->succeeded = succeeded; |
| 67 | __entry->failed = failed; |
Anshuman Khandual | 1a5bae2 | 2020-08-11 18:31:51 -0700 | [diff] [blame] | 68 | __entry->thp_succeeded = thp_succeeded; |
| 69 | __entry->thp_failed = thp_failed; |
| 70 | __entry->thp_split = thp_split; |
Mel Gorman | 7b2a2d4 | 2012-10-19 14:07:31 +0100 | [diff] [blame] | 71 | __entry->mode = mode; |
| 72 | __entry->reason = reason; |
| 73 | ), |
| 74 | |
Anshuman Khandual | 1a5bae2 | 2020-08-11 18:31:51 -0700 | [diff] [blame] | 75 | TP_printk("nr_succeeded=%lu nr_failed=%lu nr_thp_succeeded=%lu nr_thp_failed=%lu nr_thp_split=%lu mode=%s reason=%s", |
Mel Gorman | 7b2a2d4 | 2012-10-19 14:07:31 +0100 | [diff] [blame] | 76 | __entry->succeeded, |
| 77 | __entry->failed, |
Anshuman Khandual | 1a5bae2 | 2020-08-11 18:31:51 -0700 | [diff] [blame] | 78 | __entry->thp_succeeded, |
| 79 | __entry->thp_failed, |
| 80 | __entry->thp_split, |
Mel Gorman | 7b2a2d4 | 2012-10-19 14:07:31 +0100 | [diff] [blame] | 81 | __print_symbolic(__entry->mode, MIGRATE_MODE), |
| 82 | __print_symbolic(__entry->reason, MIGRATE_REASON)) |
| 83 | ); |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 84 | |
| 85 | TRACE_EVENT(mm_migrate_pages_start, |
| 86 | |
| 87 | TP_PROTO(enum migrate_mode mode, int reason), |
| 88 | |
| 89 | TP_ARGS(mode, reason), |
| 90 | |
| 91 | TP_STRUCT__entry( |
| 92 | __field(enum migrate_mode, mode) |
| 93 | __field(int, reason) |
| 94 | ), |
| 95 | |
| 96 | TP_fast_assign( |
| 97 | __entry->mode = mode; |
| 98 | __entry->reason = reason; |
| 99 | ), |
| 100 | |
| 101 | TP_printk("mode=%s reason=%s", |
| 102 | __print_symbolic(__entry->mode, MIGRATE_MODE), |
| 103 | __print_symbolic(__entry->reason, MIGRATE_REASON)) |
| 104 | ); |
| 105 | |
Mel Gorman | 7b2a2d4 | 2012-10-19 14:07:31 +0100 | [diff] [blame] | 106 | #endif /* _TRACE_MIGRATE_H */ |
| 107 | |
| 108 | /* This part must be outside protection */ |
| 109 | #include <trace/define_trace.h> |