1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM page_ref
5 #if !defined(_TRACE_PAGE_REF_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_PAGE_REF_H
8 #include <linux/types.h>
9 #include <linux/page_ref.h>
10 #include <linux/tracepoint.h>
11 #include <trace/events/mmflags.h>
13 DECLARE_EVENT_CLASS(page_ref_mod_template,
15 TP_PROTO(struct page *page, int v),
20 __field(unsigned long, pfn)
21 __field(unsigned long, flags)
23 __field(int, mapcount)
24 __field(void *, mapping)
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);
39 TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d",
41 show_page_flags(__entry->flags & PAGEFLAGS_MASK),
43 __entry->mapcount, __entry->mapping, __entry->mt,
47 DEFINE_EVENT(page_ref_mod_template, page_ref_set,
49 TP_PROTO(struct page *page, int v),
54 DEFINE_EVENT(page_ref_mod_template, page_ref_mod,
56 TP_PROTO(struct page *page, int v),
61 DECLARE_EVENT_CLASS(page_ref_mod_and_test_template,
63 TP_PROTO(struct page *page, int v, int ret),
65 TP_ARGS(page, v, ret),
68 __field(unsigned long, pfn)
69 __field(unsigned long, flags)
71 __field(int, mapcount)
72 __field(void *, mapping)
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);
89 TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d",
91 show_page_flags(__entry->flags & PAGEFLAGS_MASK),
93 __entry->mapcount, __entry->mapping, __entry->mt,
94 __entry->val, __entry->ret)
97 DEFINE_EVENT(page_ref_mod_and_test_template, page_ref_mod_and_test,
99 TP_PROTO(struct page *page, int v, int ret),
101 TP_ARGS(page, v, ret)
104 DEFINE_EVENT(page_ref_mod_and_test_template, page_ref_mod_and_return,
106 TP_PROTO(struct page *page, int v, int ret),
108 TP_ARGS(page, v, ret)
111 DEFINE_EVENT(page_ref_mod_and_test_template, page_ref_mod_unless,
113 TP_PROTO(struct page *page, int v, int ret),
115 TP_ARGS(page, v, ret)
118 DEFINE_EVENT(page_ref_mod_and_test_template, page_ref_freeze,
120 TP_PROTO(struct page *page, int v, int ret),
122 TP_ARGS(page, v, ret)
125 DEFINE_EVENT(page_ref_mod_template, page_ref_unfreeze,
127 TP_PROTO(struct page *page, int v),
132 #endif /* _TRACE_PAGE_COUNT_H */
134 /* This part must be outside protection */
135 #include <trace/define_trace.h>