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