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