page_ref.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM page_ref
  3. #if !defined(_TRACE_PAGE_REF_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_PAGE_REF_H
  5. #include <linux/types.h>
  6. #include <linux/page_ref.h>
  7. #include <linux/tracepoint.h>
  8. #include <trace/events/mmflags.h>
  9. DECLARE_EVENT_CLASS(page_ref_mod_template,
  10. TP_PROTO(struct page *page, int v),
  11. TP_ARGS(page, v),
  12. TP_STRUCT__entry(
  13. __field(unsigned long, pfn)
  14. __field(unsigned long, flags)
  15. __field(int, count)
  16. __field(int, mapcount)
  17. __field(void *, mapping)
  18. __field(int, mt)
  19. __field(int, val)
  20. ),
  21. TP_fast_assign(
  22. __entry->pfn = page_to_pfn(page);
  23. __entry->flags = page->flags;
  24. __entry->count = page_ref_count(page);
  25. __entry->mapcount = page_mapcount(page);
  26. __entry->mapping = page->mapping;
  27. __entry->mt = get_pageblock_migratetype(page);
  28. __entry->val = v;
  29. ),
  30. TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d",
  31. __entry->pfn,
  32. show_page_flags(__entry->flags & ((1UL << NR_PAGEFLAGS) - 1)),
  33. __entry->count,
  34. __entry->mapcount, __entry->mapping, __entry->mt,
  35. __entry->val)
  36. );
  37. DEFINE_EVENT(page_ref_mod_template, page_ref_set,
  38. TP_PROTO(struct page *page, int v),
  39. TP_ARGS(page, v)
  40. );
  41. DEFINE_EVENT(page_ref_mod_template, page_ref_mod,
  42. TP_PROTO(struct page *page, int v),
  43. TP_ARGS(page, v)
  44. );
  45. DECLARE_EVENT_CLASS(page_ref_mod_and_test_template,
  46. TP_PROTO(struct page *page, int v, int ret),
  47. TP_ARGS(page, v, ret),
  48. TP_STRUCT__entry(
  49. __field(unsigned long, pfn)
  50. __field(unsigned long, flags)
  51. __field(int, count)
  52. __field(int, mapcount)
  53. __field(void *, mapping)
  54. __field(int, mt)
  55. __field(int, val)
  56. __field(int, ret)
  57. ),
  58. TP_fast_assign(
  59. __entry->pfn = page_to_pfn(page);
  60. __entry->flags = page->flags;
  61. __entry->count = page_ref_count(page);
  62. __entry->mapcount = page_mapcount(page);
  63. __entry->mapping = page->mapping;
  64. __entry->mt = get_pageblock_migratetype(page);
  65. __entry->val = v;
  66. __entry->ret = ret;
  67. ),
  68. TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d",
  69. __entry->pfn,
  70. show_page_flags(__entry->flags & ((1UL << NR_PAGEFLAGS) - 1)),
  71. __entry->count,
  72. __entry->mapcount, __entry->mapping, __entry->mt,
  73. __entry->val, __entry->ret)
  74. );
  75. DEFINE_EVENT(page_ref_mod_and_test_template, page_ref_mod_and_test,
  76. TP_PROTO(struct page *page, int v, int ret),
  77. TP_ARGS(page, v, ret)
  78. );
  79. DEFINE_EVENT(page_ref_mod_and_test_template, page_ref_mod_and_return,
  80. TP_PROTO(struct page *page, int v, int ret),
  81. TP_ARGS(page, v, ret)
  82. );
  83. DEFINE_EVENT(page_ref_mod_and_test_template, page_ref_mod_unless,
  84. TP_PROTO(struct page *page, int v, int ret),
  85. TP_ARGS(page, v, ret)
  86. );
  87. DEFINE_EVENT(page_ref_mod_and_test_template, page_ref_freeze,
  88. TP_PROTO(struct page *page, int v, int ret),
  89. TP_ARGS(page, v, ret)
  90. );
  91. DEFINE_EVENT(page_ref_mod_template, page_ref_unfreeze,
  92. TP_PROTO(struct page *page, int v),
  93. TP_ARGS(page, v)
  94. );
  95. #endif /* _TRACE_PAGE_COUNT_H */
  96. /* This part must be outside protection */
  97. #include <trace/define_trace.h>