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