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