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