pagemap.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM pagemap
  3. #if !defined(_TRACE_PAGEMAP_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_PAGEMAP_H
  5. #include <linux/tracepoint.h>
  6. #include <linux/mm.h>
  7. #define PAGEMAP_MAPPED 0x0001u
  8. #define PAGEMAP_ANONYMOUS 0x0002u
  9. #define PAGEMAP_FILE 0x0004u
  10. #define PAGEMAP_SWAPCACHE 0x0008u
  11. #define PAGEMAP_SWAPBACKED 0x0010u
  12. #define PAGEMAP_MAPPEDDISK 0x0020u
  13. #define PAGEMAP_BUFFERS 0x0040u
  14. #define trace_pagemap_flags(page) ( \
  15. (PageAnon(page) ? PAGEMAP_ANONYMOUS : PAGEMAP_FILE) | \
  16. (page_mapped(page) ? PAGEMAP_MAPPED : 0) | \
  17. (PageSwapCache(page) ? PAGEMAP_SWAPCACHE : 0) | \
  18. (PageSwapBacked(page) ? PAGEMAP_SWAPBACKED : 0) | \
  19. (PageMappedToDisk(page) ? PAGEMAP_MAPPEDDISK : 0) | \
  20. (page_has_private(page) ? PAGEMAP_BUFFERS : 0) \
  21. )
  22. TRACE_EVENT(mm_lru_insertion,
  23. TP_PROTO(
  24. struct page *page,
  25. int lru
  26. ),
  27. TP_ARGS(page, lru),
  28. TP_STRUCT__entry(
  29. __field(struct page *, page )
  30. __field(unsigned long, pfn )
  31. __field(int, lru )
  32. __field(unsigned long, flags )
  33. ),
  34. TP_fast_assign(
  35. __entry->page = page;
  36. __entry->pfn = page_to_pfn(page);
  37. __entry->lru = lru;
  38. __entry->flags = trace_pagemap_flags(page);
  39. ),
  40. /* Flag format is based on page-types.c formatting for pagemap */
  41. TP_printk("page=%p pfn=%lu lru=%d flags=%s%s%s%s%s%s",
  42. __entry->page,
  43. __entry->pfn,
  44. __entry->lru,
  45. __entry->flags & PAGEMAP_MAPPED ? "M" : " ",
  46. __entry->flags & PAGEMAP_ANONYMOUS ? "a" : "f",
  47. __entry->flags & PAGEMAP_SWAPCACHE ? "s" : " ",
  48. __entry->flags & PAGEMAP_SWAPBACKED ? "b" : " ",
  49. __entry->flags & PAGEMAP_MAPPEDDISK ? "d" : " ",
  50. __entry->flags & PAGEMAP_BUFFERS ? "B" : " ")
  51. );
  52. TRACE_EVENT(mm_lru_activate,
  53. TP_PROTO(struct page *page),
  54. TP_ARGS(page),
  55. TP_STRUCT__entry(
  56. __field(struct page *, page )
  57. __field(unsigned long, pfn )
  58. ),
  59. TP_fast_assign(
  60. __entry->page = page;
  61. __entry->pfn = page_to_pfn(page);
  62. ),
  63. /* Flag format is based on page-types.c formatting for pagemap */
  64. TP_printk("page=%p pfn=%lu", __entry->page, __entry->pfn)
  65. );
  66. #endif /* _TRACE_PAGEMAP_H */
  67. /* This part must be outside protection */
  68. #include <trace/define_trace.h>