migrate.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM migrate
  3. #if !defined(_TRACE_MIGRATE_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_MIGRATE_H
  5. #include <linux/tracepoint.h>
  6. #define MIGRATE_MODE \
  7. EM( MIGRATE_ASYNC, "MIGRATE_ASYNC") \
  8. EM( MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT") \
  9. EMe(MIGRATE_SYNC, "MIGRATE_SYNC")
  10. #define MIGRATE_REASON \
  11. EM( MR_COMPACTION, "compaction") \
  12. EM( MR_MEMORY_FAILURE, "memory_failure") \
  13. EM( MR_MEMORY_HOTPLUG, "memory_hotplug") \
  14. EM( MR_SYSCALL, "syscall_or_cpuset") \
  15. EM( MR_MEMPOLICY_MBIND, "mempolicy_mbind") \
  16. EM( MR_NUMA_MISPLACED, "numa_misplaced") \
  17. EMe(MR_CMA, "cma")
  18. /*
  19. * First define the enums in the above macros to be exported to userspace
  20. * via TRACE_DEFINE_ENUM().
  21. */
  22. #undef EM
  23. #undef EMe
  24. #define EM(a, b) TRACE_DEFINE_ENUM(a);
  25. #define EMe(a, b) TRACE_DEFINE_ENUM(a);
  26. MIGRATE_MODE
  27. MIGRATE_REASON
  28. /*
  29. * Now redefine the EM() and EMe() macros to map the enums to the strings
  30. * that will be printed in the output.
  31. */
  32. #undef EM
  33. #undef EMe
  34. #define EM(a, b) {a, b},
  35. #define EMe(a, b) {a, b}
  36. TRACE_EVENT(mm_migrate_pages,
  37. TP_PROTO(unsigned long succeeded, unsigned long failed,
  38. enum migrate_mode mode, int reason),
  39. TP_ARGS(succeeded, failed, mode, reason),
  40. TP_STRUCT__entry(
  41. __field( unsigned long, succeeded)
  42. __field( unsigned long, failed)
  43. __field( enum migrate_mode, mode)
  44. __field( int, reason)
  45. ),
  46. TP_fast_assign(
  47. __entry->succeeded = succeeded;
  48. __entry->failed = failed;
  49. __entry->mode = mode;
  50. __entry->reason = reason;
  51. ),
  52. TP_printk("nr_succeeded=%lu nr_failed=%lu mode=%s reason=%s",
  53. __entry->succeeded,
  54. __entry->failed,
  55. __print_symbolic(__entry->mode, MIGRATE_MODE),
  56. __print_symbolic(__entry->reason, MIGRATE_REASON))
  57. );
  58. TRACE_EVENT(mm_numa_migrate_ratelimit,
  59. TP_PROTO(struct task_struct *p, int dst_nid, unsigned long nr_pages),
  60. TP_ARGS(p, dst_nid, nr_pages),
  61. TP_STRUCT__entry(
  62. __array( char, comm, TASK_COMM_LEN)
  63. __field( pid_t, pid)
  64. __field( int, dst_nid)
  65. __field( unsigned long, nr_pages)
  66. ),
  67. TP_fast_assign(
  68. memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
  69. __entry->pid = p->pid;
  70. __entry->dst_nid = dst_nid;
  71. __entry->nr_pages = nr_pages;
  72. ),
  73. TP_printk("comm=%s pid=%d dst_nid=%d nr_pages=%lu",
  74. __entry->comm,
  75. __entry->pid,
  76. __entry->dst_nid,
  77. __entry->nr_pages)
  78. );
  79. TRACE_EVENT(mm_migrate_pages_start,
  80. TP_PROTO(enum migrate_mode mode, int reason),
  81. TP_ARGS(mode, reason),
  82. TP_STRUCT__entry(
  83. __field(enum migrate_mode, mode)
  84. __field(int, reason)
  85. ),
  86. TP_fast_assign(
  87. __entry->mode = mode;
  88. __entry->reason = reason;
  89. ),
  90. TP_printk("mode=%s reason=%s",
  91. __print_symbolic(__entry->mode, MIGRATE_MODE),
  92. __print_symbolic(__entry->reason, MIGRATE_REASON))
  93. );
  94. #endif /* _TRACE_MIGRATE_H */
  95. /* This part must be outside protection */
  96. #include <trace/define_trace.h>