huge_memory.h 4.3 KB

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