2 #define TRACE_SYSTEM mm_vmscan
4 #if !defined(LTTNG_TRACE_MM_VMSCAN_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_MM_VMSCAN_H
7 #include "../../../probes/lttng-tracepoint-event.h"
8 #include <linux/types.h>
10 #include <linux/memcontrol.h>
11 #include <trace/events/gfpflags.h>
12 #include <linux/version.h>
14 #ifndef _TRACE_VMSCAN_DEF
15 #define _TRACE_VMSCAN_DEF
16 #define RECLAIM_WB_ANON 0x0001u
17 #define RECLAIM_WB_FILE 0x0002u
18 #define RECLAIM_WB_MIXED 0x0010u
19 #define RECLAIM_WB_SYNC 0x0004u /* Unused, all reclaim async */
20 #define RECLAIM_WB_ASYNC 0x0008u
22 #if ((LINUX_VERSION_CODE <= KERNEL_VERSION(3,0,38)) || \
23 LTTNG_KERNEL_RANGE(3,1,0, 3,2,0))
24 typedef int isolate_mode_t
;
29 LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_sleep
,
36 ctf_integer(int, nid
, nid
)
40 LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_wake
,
42 TP_PROTO(int nid
, int order
),
47 ctf_integer(int, nid
, nid
)
48 ctf_integer(int, order
, order
)
52 LTTNG_TRACEPOINT_EVENT(mm_vmscan_wakeup_kswapd
,
54 TP_PROTO(int nid
, int zid
, int order
),
56 TP_ARGS(nid
, zid
, order
),
59 ctf_integer(int, nid
, nid
)
60 ctf_integer(int, zid
, zid
)
61 ctf_integer(int, order
, order
)
65 LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template
,
67 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
69 TP_ARGS(order
, may_writepage
, gfp_flags
),
72 ctf_integer(int, order
, order
)
73 ctf_integer(int, may_writepage
, may_writepage
)
74 ctf_integer(gfp_t
, gfp_flags
, gfp_flags
)
78 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template
, mm_vmscan_direct_reclaim_begin
,
80 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
82 TP_ARGS(order
, may_writepage
, gfp_flags
)
85 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template
, mm_vmscan_memcg_reclaim_begin
,
87 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
89 TP_ARGS(order
, may_writepage
, gfp_flags
)
92 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template
, mm_vmscan_memcg_softlimit_reclaim_begin
,
94 TP_PROTO(int order
, int may_writepage
, gfp_t gfp_flags
),
96 TP_ARGS(order
, may_writepage
, gfp_flags
)
99 LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template
,
101 TP_PROTO(unsigned long nr_reclaimed
),
103 TP_ARGS(nr_reclaimed
),
106 ctf_integer(unsigned long, nr_reclaimed
, nr_reclaimed
)
110 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template
, mm_vmscan_direct_reclaim_end
,
112 TP_PROTO(unsigned long nr_reclaimed
),
114 TP_ARGS(nr_reclaimed
)
117 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template
, mm_vmscan_memcg_reclaim_end
,
119 TP_PROTO(unsigned long nr_reclaimed
),
121 TP_ARGS(nr_reclaimed
)
124 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template
, mm_vmscan_memcg_softlimit_reclaim_end
,
126 TP_PROTO(unsigned long nr_reclaimed
),
128 TP_ARGS(nr_reclaimed
)
131 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
132 LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_start
,
134 mm_vmscan_shrink_slab_start
,
136 TP_PROTO(struct shrinker
*shr
, struct shrink_control
*sc
,
137 long nr_objects_to_shrink
, unsigned long pgs_scanned
,
138 unsigned long lru_pgs
, unsigned long cache_items
,
139 unsigned long long delta
, unsigned long total_scan
),
141 TP_ARGS(shr
, sc
, nr_objects_to_shrink
, pgs_scanned
, lru_pgs
,
142 cache_items
, delta
, total_scan
),
145 ctf_integer(struct shrinker
*, shr
, shr
)
146 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
147 ctf_integer(void *, shrink
, shr
->scan_objects
)
148 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
149 ctf_integer(void *, shrink
, shr
->shrink
)
150 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
151 ctf_integer(long, nr_objects_to_shrink
, nr_objects_to_shrink
)
152 ctf_integer(gfp_t
, gfp_flags
, sc
->gfp_mask
)
153 ctf_integer(unsigned long, pgs_scanned
, pgs_scanned
)
154 ctf_integer(unsigned long, lru_pgs
, lru_pgs
)
155 ctf_integer(unsigned long, cache_items
, cache_items
)
156 ctf_integer(unsigned long long, delta
, delta
)
157 ctf_integer(unsigned long, total_scan
, total_scan
)
161 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
162 LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end
,
164 mm_vmscan_shrink_slab_end
,
166 TP_PROTO(struct shrinker
*shr
, int nid
, int shrinker_retval
,
167 long unused_scan_cnt
, long new_scan_cnt
, long total_scan
),
169 TP_ARGS(shr
, nid
, shrinker_retval
, unused_scan_cnt
, new_scan_cnt
,
173 ctf_integer(struct shrinker
*, shr
, shr
)
174 ctf_integer(int, nid
, nid
)
175 ctf_integer(void *, shrink
, shr
->scan_objects
)
176 ctf_integer(long, unused_scan
, unused_scan_cnt
)
177 ctf_integer(long, new_scan
, new_scan_cnt
)
178 ctf_integer(int, retval
, shrinker_retval
)
179 ctf_integer(long, total_scan
, total_scan
)
182 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
183 LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end
,
185 mm_vmscan_shrink_slab_end
,
187 TP_PROTO(struct shrinker
*shr
, int shrinker_retval
,
188 long unused_scan_cnt
, long new_scan_cnt
),
190 TP_ARGS(shr
, shrinker_retval
, unused_scan_cnt
, new_scan_cnt
),
193 ctf_integer(struct shrinker
*, shr
, shr
)
194 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
195 ctf_integer(void *, shrink
, shr
->scan_objects
)
196 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
197 ctf_integer(void *, shrink
, shr
->shrink
)
198 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
199 ctf_integer(long, unused_scan
, unused_scan_cnt
)
200 ctf_integer(long, new_scan
, new_scan_cnt
)
201 ctf_integer(int, retval
, shrinker_retval
)
202 ctf_integer(long, total_scan
, new_scan_cnt
- unused_scan_cnt
)
205 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
208 LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_lru_isolate_template
,
211 unsigned long nr_requested
,
212 unsigned long nr_scanned
,
213 unsigned long nr_taken
,
214 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
215 unsigned long nr_lumpy_taken
,
216 unsigned long nr_lumpy_dirty
,
217 unsigned long nr_lumpy_failed
,
219 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
220 isolate_mode_t isolate_mode
222 isolate_mode_t isolate_mode
,
227 TP_ARGS(order
, nr_requested
, nr_scanned
, nr_taken
,
228 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
229 nr_lumpy_taken
, nr_lumpy_dirty
, nr_lumpy_failed
,
231 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
240 ctf_integer(int, order
, order
)
241 ctf_integer(unsigned long, nr_requested
, nr_requested
)
242 ctf_integer(unsigned long, nr_scanned
, nr_scanned
)
243 ctf_integer(unsigned long, nr_taken
, nr_taken
)
244 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
245 ctf_integer(unsigned long, nr_lumpy_taken
, nr_lumpy_taken
)
246 ctf_integer(unsigned long, nr_lumpy_dirty
, nr_lumpy_dirty
)
247 ctf_integer(unsigned long, nr_lumpy_failed
, nr_lumpy_failed
)
249 ctf_integer(isolate_mode_t
, isolate_mode
, isolate_mode
)
250 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
251 ctf_integer(int, file
, file
)
256 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template
, mm_vmscan_lru_isolate
,
259 unsigned long nr_requested
,
260 unsigned long nr_scanned
,
261 unsigned long nr_taken
,
262 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
263 unsigned long nr_lumpy_taken
,
264 unsigned long nr_lumpy_dirty
,
265 unsigned long nr_lumpy_failed
,
267 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
268 isolate_mode_t isolate_mode
270 isolate_mode_t isolate_mode
,
275 TP_ARGS(order
, nr_requested
, nr_scanned
, nr_taken
,
276 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
277 nr_lumpy_taken
, nr_lumpy_dirty
, nr_lumpy_failed
,
279 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
288 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template
, mm_vmscan_memcg_isolate
,
291 unsigned long nr_requested
,
292 unsigned long nr_scanned
,
293 unsigned long nr_taken
,
294 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
295 unsigned long nr_lumpy_taken
,
296 unsigned long nr_lumpy_dirty
,
297 unsigned long nr_lumpy_failed
,
299 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
300 isolate_mode_t isolate_mode
302 isolate_mode_t isolate_mode
,
307 TP_ARGS(order
, nr_requested
, nr_scanned
, nr_taken
,
308 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
309 nr_lumpy_taken
, nr_lumpy_dirty
, nr_lumpy_failed
,
311 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
319 LTTNG_TRACEPOINT_EVENT(mm_vmscan_writepage
,
321 TP_PROTO(struct page
*page
,
324 TP_ARGS(page
, reclaim_flags
),
327 ctf_integer(struct page
*, page
, page
)
328 ctf_integer(int, reclaim_flags
, reclaim_flags
)
332 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
333 LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive
,
335 TP_PROTO(int nid
, int zid
,
336 unsigned long nr_scanned
, unsigned long nr_reclaimed
,
337 int priority
, int reclaim_flags
),
339 TP_ARGS(nid
, zid
, nr_scanned
, nr_reclaimed
, priority
, reclaim_flags
),
342 ctf_integer(int, nid
, nid
)
343 ctf_integer(int, zid
, zid
)
344 ctf_integer(unsigned long, nr_scanned
, nr_scanned
)
345 ctf_integer(unsigned long, nr_reclaimed
, nr_reclaimed
)
346 ctf_integer(int, priority
, priority
)
347 ctf_integer(int, reclaim_flags
, reclaim_flags
)
352 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
353 LTTNG_TRACEPOINT_EVENT_MAP(replace_swap_token
,
355 mm_vmscan_replace_swap_token
,
357 TP_PROTO(struct mm_struct
*old_mm
,
358 struct mm_struct
*new_mm
),
360 TP_ARGS(old_mm
, new_mm
),
363 ctf_integer(struct mm_struct
*, old_mm
, old_mm
)
364 ctf_integer(unsigned int, old_prio
, old_mm
? old_mm
->token_priority
: 0)
365 ctf_integer(struct mm_struct
*, new_mm
, new_mm
)
366 ctf_integer(unsigned int, new_prio
, new_mm
->token_priority
)
370 LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_put_swap_token_template
,
371 TP_PROTO(struct mm_struct
*swap_token_mm
),
373 TP_ARGS(swap_token_mm
),
376 ctf_integer(struct mm_struct
*, swap_token_mm
, swap_token_mm
)
380 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(mm_vmscan_put_swap_token_template
, put_swap_token
,
382 mm_vmscan_put_swap_token
,
384 TP_PROTO(struct mm_struct
*swap_token_mm
),
385 TP_ARGS(swap_token_mm
)
388 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(mm_vmscan_put_swap_token_template
, disable_swap_token
,
390 mm_vmscan_disable_swap_token
,
392 TP_PROTO(struct mm_struct
*swap_token_mm
),
393 TP_ARGS(swap_token_mm
)
396 LTTNG_TRACEPOINT_EVENT_MAP(update_swap_token_priority
,
398 mm_vmscan_update_swap_token_priority
,
400 TP_PROTO(struct mm_struct
*mm
,
401 unsigned int old_prio
,
402 struct mm_struct
*swap_token_mm
),
404 TP_ARGS(mm
, old_prio
, swap_token_mm
),
407 ctf_integer(struct mm_struct
*, mm
, mm
)
408 ctf_integer(unsigned int, old_prio
, old_prio
)
409 ctf_integer(unsigned int, new_prio
, mm
->token_priority
)
410 ctf_integer(struct mm_struct
*, swap_token_mm
, swap_token_mm
)
411 ctf_integer(unsigned int, swap_token_prio
, swap_token_mm
? swap_token_mm
->token_priority
: 0)
416 #endif /* LTTNG_TRACE_MM_VMSCAN_H */
418 /* This part must be outside protection */
419 #include "../../../probes/define_trace.h"