2 #define TRACE_SYSTEM vmscan
4 #if !defined(_TRACE_VMSCAN_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_VMSCAN_H
7 #include <linux/types.h>
8 #include <linux/tracepoint.h>
11 #define RECLAIM_WB_ANON 0x0001u
12 #define RECLAIM_WB_FILE 0x0002u
13 #define RECLAIM_WB_SYNC 0x0004u
14 #define RECLAIM_WB_ASYNC 0x0008u
16 #define show_reclaim_flags(flags) \
17 (flags) ? __print_flags(flags, "|", \
18 {RECLAIM_WB_ANON, "RECLAIM_WB_ANON"}, \
19 {RECLAIM_WB_FILE, "RECLAIM_WB_FILE"}, \
20 {RECLAIM_WB_SYNC, "RECLAIM_WB_SYNC"}, \
21 {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \
24 #define trace_reclaim_flags(page, sync) ( \
25 (page_is_file_cache(page) ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
26 (sync == PAGEOUT_IO_SYNC ? RECLAIM_WB_SYNC : RECLAIM_WB_ASYNC) \
29 TRACE_EVENT(mm_vmscan_kswapd_sleep
,
43 TP_printk("nid=%d", __entry
->nid
)
46 TRACE_EVENT(mm_vmscan_kswapd_wake
,
48 TP_PROTO(int nid
, int order
),
59 __entry
->order
= order
;
62 TP_printk("nid=%d order=%d", __entry
->nid
, __entry
->order
)
65 TRACE_EVENT(mm_vmscan_wakeup_kswapd
,
67 TP_PROTO(int nid
, int zid
, int order
),
69 TP_ARGS(nid
, zid
, order
),
80 __entry
->order
= order
;
83 TP_printk("nid=%d zid=%d order=%d",
89 DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template
,
91 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
93 TP_ARGS(order
, may_writepage
, gfp_flags
),
97 __field( int, may_writepage
)
98 __field( gfp_t
, gfp_flags
)
102 __entry
->order
= order
;
103 __entry
->may_writepage
= may_writepage
;
104 __entry
->gfp_flags
= gfp_flags
;
107 TP_printk("order=%d may_writepage=%d gfp_flags=%s",
109 __entry
->may_writepage
,
110 show_gfp_flags(__entry
->gfp_flags
))
113 DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template
, mm_vmscan_direct_reclaim_begin
,
115 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
117 TP_ARGS(order
, may_writepage
, gfp_flags
)
120 DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template
, mm_vmscan_memcg_reclaim_begin
,
122 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
124 TP_ARGS(order
, may_writepage
, gfp_flags
)
127 DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template
, mm_vmscan_memcg_softlimit_reclaim_begin
,
129 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
131 TP_ARGS(order
, may_writepage
, gfp_flags
)
134 DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template
,
136 TP_PROTO(unsigned long nr_reclaimed
),
138 TP_ARGS(nr_reclaimed
),
141 __field( unsigned long, nr_reclaimed
)
145 __entry
->nr_reclaimed
= nr_reclaimed
;
148 TP_printk("nr_reclaimed=%lu", __entry
->nr_reclaimed
)
151 DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template
, mm_vmscan_direct_reclaim_end
,
153 TP_PROTO(unsigned long nr_reclaimed
),
155 TP_ARGS(nr_reclaimed
)
158 DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template
, mm_vmscan_memcg_reclaim_end
,
160 TP_PROTO(unsigned long nr_reclaimed
),
162 TP_ARGS(nr_reclaimed
)
165 DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template
, mm_vmscan_memcg_softlimit_reclaim_end
,
167 TP_PROTO(unsigned long nr_reclaimed
),
169 TP_ARGS(nr_reclaimed
)
173 DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template
,
176 unsigned long nr_requested
,
177 unsigned long nr_scanned
,
178 unsigned long nr_taken
,
179 unsigned long nr_lumpy_taken
,
180 unsigned long nr_lumpy_dirty
,
181 unsigned long nr_lumpy_failed
,
184 TP_ARGS(order
, nr_requested
, nr_scanned
, nr_taken
, nr_lumpy_taken
, nr_lumpy_dirty
, nr_lumpy_failed
, isolate_mode
),
188 __field(unsigned long, nr_requested
)
189 __field(unsigned long, nr_scanned
)
190 __field(unsigned long, nr_taken
)
191 __field(unsigned long, nr_lumpy_taken
)
192 __field(unsigned long, nr_lumpy_dirty
)
193 __field(unsigned long, nr_lumpy_failed
)
194 __field(int, isolate_mode
)
198 __entry
->order
= order
;
199 __entry
->nr_requested
= nr_requested
;
200 __entry
->nr_scanned
= nr_scanned
;
201 __entry
->nr_taken
= nr_taken
;
202 __entry
->nr_lumpy_taken
= nr_lumpy_taken
;
203 __entry
->nr_lumpy_dirty
= nr_lumpy_dirty
;
204 __entry
->nr_lumpy_failed
= nr_lumpy_failed
;
205 __entry
->isolate_mode
= isolate_mode
;
208 TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu",
209 __entry
->isolate_mode
,
211 __entry
->nr_requested
,
214 __entry
->nr_lumpy_taken
,
215 __entry
->nr_lumpy_dirty
,
216 __entry
->nr_lumpy_failed
)
219 DEFINE_EVENT(mm_vmscan_lru_isolate_template
, mm_vmscan_lru_isolate
,
222 unsigned long nr_requested
,
223 unsigned long nr_scanned
,
224 unsigned long nr_taken
,
225 unsigned long nr_lumpy_taken
,
226 unsigned long nr_lumpy_dirty
,
227 unsigned long nr_lumpy_failed
,
230 TP_ARGS(order
, nr_requested
, nr_scanned
, nr_taken
, nr_lumpy_taken
, nr_lumpy_dirty
, nr_lumpy_failed
, isolate_mode
)
234 DEFINE_EVENT(mm_vmscan_lru_isolate_template
, mm_vmscan_memcg_isolate
,
237 unsigned long nr_requested
,
238 unsigned long nr_scanned
,
239 unsigned long nr_taken
,
240 unsigned long nr_lumpy_taken
,
241 unsigned long nr_lumpy_dirty
,
242 unsigned long nr_lumpy_failed
,
245 TP_ARGS(order
, nr_requested
, nr_scanned
, nr_taken
, nr_lumpy_taken
, nr_lumpy_dirty
, nr_lumpy_failed
, isolate_mode
)
249 TRACE_EVENT(mm_vmscan_writepage
,
251 TP_PROTO(struct page
*page
,
254 TP_ARGS(page
, reclaim_flags
),
257 __field(struct page
*, page
)
258 __field(int, reclaim_flags
)
262 __entry
->page
= page
;
263 __entry
->reclaim_flags
= reclaim_flags
;
266 TP_printk("page=%p pfn=%lu flags=%s",
268 page_to_pfn(__entry
->page
),
269 show_reclaim_flags(__entry
->reclaim_flags
))
272 #endif /* _TRACE_VMSCAN_H */
274 /* This part must be outside protection */
275 #include <trace/define_trace.h>