Mel Gorman | c6286c9 | 2013-07-03 15:02:26 -0700 | [diff] [blame] | 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, |
Mel Gorman | 24b7e58 | 2014-08-06 16:07:11 -0700 | [diff] [blame] | 31 | int lru |
Mel Gorman | c6286c9 | 2013-07-03 15:02:26 -0700 | [diff] [blame] | 32 | ), |
| 33 | |
Mel Gorman | 24b7e58 | 2014-08-06 16:07:11 -0700 | [diff] [blame] | 34 | TP_ARGS(page, lru), |
Mel Gorman | c6286c9 | 2013-07-03 15:02:26 -0700 | [diff] [blame] | 35 | |
| 36 | TP_STRUCT__entry( |
| 37 | __field(struct page *, page ) |
| 38 | __field(unsigned long, pfn ) |
| 39 | __field(int, lru ) |
| 40 | __field(unsigned long, flags ) |
| 41 | ), |
| 42 | |
| 43 | TP_fast_assign( |
| 44 | __entry->page = page; |
Mel Gorman | 24b7e58 | 2014-08-06 16:07:11 -0700 | [diff] [blame] | 45 | __entry->pfn = page_to_pfn(page); |
Mel Gorman | c6286c9 | 2013-07-03 15:02:26 -0700 | [diff] [blame] | 46 | __entry->lru = lru; |
Mel Gorman | 24b7e58 | 2014-08-06 16:07:11 -0700 | [diff] [blame] | 47 | __entry->flags = trace_pagemap_flags(page); |
Mel Gorman | c6286c9 | 2013-07-03 15:02:26 -0700 | [diff] [blame] | 48 | ), |
| 49 | |
| 50 | /* Flag format is based on page-types.c formatting for pagemap */ |
| 51 | TP_printk("page=%p pfn=%lu lru=%d flags=%s%s%s%s%s%s", |
| 52 | __entry->page, |
| 53 | __entry->pfn, |
| 54 | __entry->lru, |
| 55 | __entry->flags & PAGEMAP_MAPPED ? "M" : " ", |
| 56 | __entry->flags & PAGEMAP_ANONYMOUS ? "a" : "f", |
| 57 | __entry->flags & PAGEMAP_SWAPCACHE ? "s" : " ", |
| 58 | __entry->flags & PAGEMAP_SWAPBACKED ? "b" : " ", |
| 59 | __entry->flags & PAGEMAP_MAPPEDDISK ? "d" : " ", |
| 60 | __entry->flags & PAGEMAP_BUFFERS ? "B" : " ") |
| 61 | ); |
| 62 | |
| 63 | TRACE_EVENT(mm_lru_activate, |
| 64 | |
Mel Gorman | 24b7e58 | 2014-08-06 16:07:11 -0700 | [diff] [blame] | 65 | TP_PROTO(struct page *page), |
Mel Gorman | c6286c9 | 2013-07-03 15:02:26 -0700 | [diff] [blame] | 66 | |
Mel Gorman | 24b7e58 | 2014-08-06 16:07:11 -0700 | [diff] [blame] | 67 | TP_ARGS(page), |
Mel Gorman | c6286c9 | 2013-07-03 15:02:26 -0700 | [diff] [blame] | 68 | |
| 69 | TP_STRUCT__entry( |
| 70 | __field(struct page *, page ) |
| 71 | __field(unsigned long, pfn ) |
| 72 | ), |
| 73 | |
| 74 | TP_fast_assign( |
| 75 | __entry->page = page; |
Mel Gorman | 24b7e58 | 2014-08-06 16:07:11 -0700 | [diff] [blame] | 76 | __entry->pfn = page_to_pfn(page); |
Mel Gorman | c6286c9 | 2013-07-03 15:02:26 -0700 | [diff] [blame] | 77 | ), |
| 78 | |
| 79 | /* Flag format is based on page-types.c formatting for pagemap */ |
| 80 | TP_printk("page=%p pfn=%lu", __entry->page, __entry->pfn) |
| 81 | |
| 82 | ); |
| 83 | |
| 84 | #endif /* _TRACE_PAGEMAP_H */ |
| 85 | |
| 86 | /* This part must be outside protection */ |
| 87 | #include <trace/define_trace.h> |