huge_memory.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM huge_memory
  3. #if !defined(__HUGE_MEMORY_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define __HUGE_MEMORY_H
  5. #include <linux/tracepoint.h>
  6. #define SCAN_STATUS \
  7. EM( SCAN_FAIL, "failed") \
  8. EM( SCAN_SUCCEED, "succeeded") \
  9. EM( SCAN_PMD_NULL, "pmd_null") \
  10. EM( SCAN_EXCEED_NONE_PTE, "exceed_none_pte") \
  11. EM( SCAN_PTE_NON_PRESENT, "pte_non_present") \
  12. EM( SCAN_PAGE_RO, "no_writable_page") \
  13. EM( SCAN_LACK_REFERENCED_PAGE, "lack_referenced_page") \
  14. EM( SCAN_PAGE_NULL, "page_null") \
  15. EM( SCAN_SCAN_ABORT, "scan_aborted") \
  16. EM( SCAN_PAGE_COUNT, "not_suitable_page_count") \
  17. EM( SCAN_PAGE_LRU, "page_not_in_lru") \
  18. EM( SCAN_PAGE_LOCK, "page_locked") \
  19. EM( SCAN_PAGE_ANON, "page_not_anon") \
  20. EM( SCAN_PAGE_COMPOUND, "page_compound") \
  21. EM( SCAN_ANY_PROCESS, "no_process_for_page") \
  22. EM( SCAN_VMA_NULL, "vma_null") \
  23. EM( SCAN_VMA_CHECK, "vma_check_failed") \
  24. EM( SCAN_ADDRESS_RANGE, "not_suitable_address_range") \
  25. EM( SCAN_SWAP_CACHE_PAGE, "page_swap_cache") \
  26. EM( SCAN_DEL_PAGE_LRU, "could_not_delete_page_from_lru")\
  27. EM( SCAN_ALLOC_HUGE_PAGE_FAIL, "alloc_huge_page_failed") \
  28. EM( SCAN_CGROUP_CHARGE_FAIL, "ccgroup_charge_failed") \
  29. EM( SCAN_EXCEED_SWAP_PTE, "exceed_swap_pte") \
  30. EMe(SCAN_TRUNCATED, "truncated") \
  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. SCAN_STATUS
  36. #undef EM
  37. #undef EMe
  38. #define EM(a, b) {a, b},
  39. #define EMe(a, b) {a, b}
  40. TRACE_EVENT(mm_khugepaged_scan_pmd,
  41. TP_PROTO(struct mm_struct *mm, struct page *page, bool writable,
  42. int referenced, int none_or_zero, int status, int unmapped),
  43. TP_ARGS(mm, page, writable, referenced, none_or_zero, status, unmapped),
  44. TP_STRUCT__entry(
  45. __field(struct mm_struct *, mm)
  46. __field(unsigned long, pfn)
  47. __field(bool, writable)
  48. __field(int, referenced)
  49. __field(int, none_or_zero)
  50. __field(int, status)
  51. __field(int, unmapped)
  52. ),
  53. TP_fast_assign(
  54. __entry->mm = mm;
  55. __entry->pfn = page ? page_to_pfn(page) : -1;
  56. __entry->writable = writable;
  57. __entry->referenced = referenced;
  58. __entry->none_or_zero = none_or_zero;
  59. __entry->status = status;
  60. __entry->unmapped = unmapped;
  61. ),
  62. TP_printk("mm=%p, scan_pfn=0x%lx, writable=%d, referenced=%d, none_or_zero=%d, status=%s, unmapped=%d",
  63. __entry->mm,
  64. __entry->pfn,
  65. __entry->writable,
  66. __entry->referenced,
  67. __entry->none_or_zero,
  68. __print_symbolic(__entry->status, SCAN_STATUS),
  69. __entry->unmapped)
  70. );
  71. TRACE_EVENT(mm_collapse_huge_page,
  72. TP_PROTO(struct mm_struct *mm, int isolated, int status),
  73. TP_ARGS(mm, isolated, status),
  74. TP_STRUCT__entry(
  75. __field(struct mm_struct *, mm)
  76. __field(int, isolated)
  77. __field(int, status)
  78. ),
  79. TP_fast_assign(
  80. __entry->mm = mm;
  81. __entry->isolated = isolated;
  82. __entry->status = status;
  83. ),
  84. TP_printk("mm=%p, isolated=%d, status=%s",
  85. __entry->mm,
  86. __entry->isolated,
  87. __print_symbolic(__entry->status, SCAN_STATUS))
  88. );
  89. TRACE_EVENT(mm_collapse_huge_page_isolate,
  90. TP_PROTO(struct page *page, int none_or_zero,
  91. int referenced, bool writable, int status),
  92. TP_ARGS(page, none_or_zero, referenced, writable, status),
  93. TP_STRUCT__entry(
  94. __field(unsigned long, pfn)
  95. __field(int, none_or_zero)
  96. __field(int, referenced)
  97. __field(bool, writable)
  98. __field(int, status)
  99. ),
  100. TP_fast_assign(
  101. __entry->pfn = page ? page_to_pfn(page) : -1;
  102. __entry->none_or_zero = none_or_zero;
  103. __entry->referenced = referenced;
  104. __entry->writable = writable;
  105. __entry->status = status;
  106. ),
  107. TP_printk("scan_pfn=0x%lx, none_or_zero=%d, referenced=%d, writable=%d, status=%s",
  108. __entry->pfn,
  109. __entry->none_or_zero,
  110. __entry->referenced,
  111. __entry->writable,
  112. __print_symbolic(__entry->status, SCAN_STATUS))
  113. );
  114. TRACE_EVENT(mm_collapse_huge_page_swapin,
  115. TP_PROTO(struct mm_struct *mm, int swapped_in, int referenced, int ret),
  116. TP_ARGS(mm, swapped_in, referenced, ret),
  117. TP_STRUCT__entry(
  118. __field(struct mm_struct *, mm)
  119. __field(int, swapped_in)
  120. __field(int, referenced)
  121. __field(int, ret)
  122. ),
  123. TP_fast_assign(
  124. __entry->mm = mm;
  125. __entry->swapped_in = swapped_in;
  126. __entry->referenced = referenced;
  127. __entry->ret = ret;
  128. ),
  129. TP_printk("mm=%p, swapped_in=%d, referenced=%d, ret=%d",
  130. __entry->mm,
  131. __entry->swapped_in,
  132. __entry->referenced,
  133. __entry->ret)
  134. );
  135. #endif /* __HUGE_MEMORY_H */
  136. #include <trace/define_trace.h>