migrate.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM migrate
  4. #if !defined(_TRACE_MIGRATE_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_MIGRATE_H
  6. #include <linux/tracepoint.h>
  7. #define MIGRATE_MODE \
  8. EM( MIGRATE_ASYNC, "MIGRATE_ASYNC") \
  9. EM( MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT") \
  10. EMe(MIGRATE_SYNC, "MIGRATE_SYNC")
  11. #define MIGRATE_REASON \
  12. EM( MR_COMPACTION, "compaction") \
  13. EM( MR_MEMORY_FAILURE, "memory_failure") \
  14. EM( MR_MEMORY_HOTPLUG, "memory_hotplug") \
  15. EM( MR_SYSCALL, "syscall_or_cpuset") \
  16. EM( MR_MEMPOLICY_MBIND, "mempolicy_mbind") \
  17. EM( MR_NUMA_MISPLACED, "numa_misplaced") \
  18. EMe(MR_CONTIG_RANGE, "contig_range")
  19. /*
  20. * First define the enums in the above macros to be exported to userspace
  21. * via TRACE_DEFINE_ENUM().
  22. */
  23. #undef EM
  24. #undef EMe
  25. #define EM(a, b) TRACE_DEFINE_ENUM(a);
  26. #define EMe(a, b) TRACE_DEFINE_ENUM(a);
  27. MIGRATE_MODE
  28. MIGRATE_REASON
  29. /*
  30. * Now redefine the EM() and EMe() macros to map the enums to the strings
  31. * that will be printed in the output.
  32. */
  33. #undef EM
  34. #undef EMe
  35. #define EM(a, b) {a, b},
  36. #define EMe(a, b) {a, b}
  37. TRACE_EVENT(mm_migrate_pages,
  38. TP_PROTO(unsigned long succeeded, unsigned long failed,
  39. enum migrate_mode mode, int reason),
  40. TP_ARGS(succeeded, failed, mode, reason),
  41. TP_STRUCT__entry(
  42. __field( unsigned long, succeeded)
  43. __field( unsigned long, failed)
  44. __field( enum migrate_mode, mode)
  45. __field( int, reason)
  46. ),
  47. TP_fast_assign(
  48. __entry->succeeded = succeeded;
  49. __entry->failed = failed;
  50. __entry->mode = mode;
  51. __entry->reason = reason;
  52. ),
  53. TP_printk("nr_succeeded=%lu nr_failed=%lu mode=%s reason=%s",
  54. __entry->succeeded,
  55. __entry->failed,
  56. __print_symbolic(__entry->mode, MIGRATE_MODE),
  57. __print_symbolic(__entry->reason, MIGRATE_REASON))
  58. );
  59. #endif /* _TRACE_MIGRATE_H */
  60. /* This part must be outside protection */
  61. #include <trace/define_trace.h>