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_MIXED 0x0010u
14 #define RECLAIM_WB_SYNC 0x0004u
15 #define RECLAIM_WB_ASYNC 0x0008u
17 #define show_reclaim_flags(flags) \
18 (flags) ? __print_flags(flags, "|", \
19 {RECLAIM_WB_ANON, "RECLAIM_WB_ANON"}, \
20 {RECLAIM_WB_FILE, "RECLAIM_WB_FILE"}, \
21 {RECLAIM_WB_MIXED, "RECLAIM_WB_MIXED"}, \
22 {RECLAIM_WB_SYNC, "RECLAIM_WB_SYNC"}, \
23 {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \
26 #define trace_reclaim_flags(page, sync) ( \
27 (page_is_file_cache(page) ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
28 (sync & RECLAIM_MODE_SYNC ? RECLAIM_WB_SYNC : RECLAIM_WB_ASYNC) \
31 #define trace_shrink_flags(file, sync) ( \
32 (sync & RECLAIM_MODE_SYNC ? RECLAIM_WB_MIXED : \
33 (file ? RECLAIM_WB_FILE : RECLAIM_WB_ANON)) | \
34 (sync & RECLAIM_MODE_SYNC ? RECLAIM_WB_SYNC : RECLAIM_WB_ASYNC) \
37 TRACE_EVENT(mm_vmscan_kswapd_sleep
,
51 TP_printk("nid=%d", __entry
->nid
)
54 TRACE_EVENT(mm_vmscan_kswapd_wake
,
56 TP_PROTO(int nid
, int order
),
67 __entry
->order
= order
;
70 TP_printk("nid=%d order=%d", __entry
->nid
, __entry
->order
)
73 TRACE_EVENT(mm_vmscan_wakeup_kswapd
,
75 TP_PROTO(int nid
, int zid
, int order
),
77 TP_ARGS(nid
, zid
, order
),
88 __entry
->order
= order
;
91 TP_printk("nid=%d zid=%d order=%d",
97 DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template
,
99 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
101 TP_ARGS(order
, may_writepage
, gfp_flags
),
104 __field( int, order
)
105 __field( int, may_writepage
)
106 __field( gfp_t
, gfp_flags
)
110 __entry
->order
= order
;
111 __entry
->may_writepage
= may_writepage
;
112 __entry
->gfp_flags
= gfp_flags
;
115 TP_printk("order=%d may_writepage=%d gfp_flags=%s",
117 __entry
->may_writepage
,
118 show_gfp_flags(__entry
->gfp_flags
))
121 DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template
, mm_vmscan_direct_reclaim_begin
,
123 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
125 TP_ARGS(order
, may_writepage
, gfp_flags
)
128 DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template
, mm_vmscan_memcg_reclaim_begin
,
130 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
132 TP_ARGS(order
, may_writepage
, gfp_flags
)
135 DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template
, mm_vmscan_memcg_softlimit_reclaim_begin
,
137 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
139 TP_ARGS(order
, may_writepage
, gfp_flags
)
142 DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template
,
144 TP_PROTO(unsigned long nr_reclaimed
),
146 TP_ARGS(nr_reclaimed
),
149 __field( unsigned long, nr_reclaimed
)
153 __entry
->nr_reclaimed
= nr_reclaimed
;
156 TP_printk("nr_reclaimed=%lu", __entry
->nr_reclaimed
)
159 DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template
, mm_vmscan_direct_reclaim_end
,
161 TP_PROTO(unsigned long nr_reclaimed
),
163 TP_ARGS(nr_reclaimed
)
166 DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template
, mm_vmscan_memcg_reclaim_end
,
168 TP_PROTO(unsigned long nr_reclaimed
),
170 TP_ARGS(nr_reclaimed
)
173 DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template
, mm_vmscan_memcg_softlimit_reclaim_end
,
175 TP_PROTO(unsigned long nr_reclaimed
),
177 TP_ARGS(nr_reclaimed
)
181 DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template
,
184 unsigned long nr_requested
,
185 unsigned long nr_scanned
,
186 unsigned long nr_taken
,
187 unsigned long nr_lumpy_taken
,
188 unsigned long nr_lumpy_dirty
,
189 unsigned long nr_lumpy_failed
,
192 TP_ARGS(order
, nr_requested
, nr_scanned
, nr_taken
, nr_lumpy_taken
, nr_lumpy_dirty
, nr_lumpy_failed
, isolate_mode
),
196 __field(unsigned long, nr_requested
)
197 __field(unsigned long, nr_scanned
)
198 __field(unsigned long, nr_taken
)
199 __field(unsigned long, nr_lumpy_taken
)
200 __field(unsigned long, nr_lumpy_dirty
)
201 __field(unsigned long, nr_lumpy_failed
)
202 __field(int, isolate_mode
)
206 __entry
->order
= order
;
207 __entry
->nr_requested
= nr_requested
;
208 __entry
->nr_scanned
= nr_scanned
;
209 __entry
->nr_taken
= nr_taken
;
210 __entry
->nr_lumpy_taken
= nr_lumpy_taken
;
211 __entry
->nr_lumpy_dirty
= nr_lumpy_dirty
;
212 __entry
->nr_lumpy_failed
= nr_lumpy_failed
;
213 __entry
->isolate_mode
= isolate_mode
;
216 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",
217 __entry
->isolate_mode
,
219 __entry
->nr_requested
,
222 __entry
->nr_lumpy_taken
,
223 __entry
->nr_lumpy_dirty
,
224 __entry
->nr_lumpy_failed
)
227 DEFINE_EVENT(mm_vmscan_lru_isolate_template
, mm_vmscan_lru_isolate
,
230 unsigned long nr_requested
,
231 unsigned long nr_scanned
,
232 unsigned long nr_taken
,
233 unsigned long nr_lumpy_taken
,
234 unsigned long nr_lumpy_dirty
,
235 unsigned long nr_lumpy_failed
,
238 TP_ARGS(order
, nr_requested
, nr_scanned
, nr_taken
, nr_lumpy_taken
, nr_lumpy_dirty
, nr_lumpy_failed
, isolate_mode
)
242 DEFINE_EVENT(mm_vmscan_lru_isolate_template
, mm_vmscan_memcg_isolate
,
245 unsigned long nr_requested
,
246 unsigned long nr_scanned
,
247 unsigned long nr_taken
,
248 unsigned long nr_lumpy_taken
,
249 unsigned long nr_lumpy_dirty
,
250 unsigned long nr_lumpy_failed
,
253 TP_ARGS(order
, nr_requested
, nr_scanned
, nr_taken
, nr_lumpy_taken
, nr_lumpy_dirty
, nr_lumpy_failed
, isolate_mode
)
257 TRACE_EVENT(mm_vmscan_writepage
,
259 TP_PROTO(struct page
*page
,
262 TP_ARGS(page
, reclaim_flags
),
265 __field(struct page
*, page
)
266 __field(int, reclaim_flags
)
270 __entry
->page
= page
;
271 __entry
->reclaim_flags
= reclaim_flags
;
274 TP_printk("page=%p pfn=%lu flags=%s",
276 page_to_pfn(__entry
->page
),
277 show_reclaim_flags(__entry
->reclaim_flags
))
280 TRACE_EVENT(mm_vmscan_lru_shrink_inactive
,
282 TP_PROTO(int nid
, int zid
,
283 unsigned long nr_scanned
, unsigned long nr_reclaimed
,
284 int priority
, int reclaim_flags
),
286 TP_ARGS(nid
, zid
, nr_scanned
, nr_reclaimed
, priority
, reclaim_flags
),
291 __field(unsigned long, nr_scanned
)
292 __field(unsigned long, nr_reclaimed
)
293 __field(int, priority
)
294 __field(int, reclaim_flags
)
300 __entry
->nr_scanned
= nr_scanned
;
301 __entry
->nr_reclaimed
= nr_reclaimed
;
302 __entry
->priority
= priority
;
303 __entry
->reclaim_flags
= reclaim_flags
;
306 TP_printk("nid=%d zid=%d nr_scanned=%ld nr_reclaimed=%ld priority=%d flags=%s",
307 __entry
->nid
, __entry
->zid
,
308 __entry
->nr_scanned
, __entry
->nr_reclaimed
,
310 show_reclaim_flags(__entry
->reclaim_flags
))
314 #endif /* _TRACE_VMSCAN_H */
316 /* This part must be outside protection */
317 #include <trace/define_trace.h>